Sheets GAS editor, trying to form an array, reduce to combine it/sum values and then reprint it, cant build 2D Array of final data

Issues:

First: pNameF is a 1D array so accessing the index then further getting the [0] gets you the F instead of FRASLE.

To fix this, modify:

pNameF.push('FRASLE')

To:

pNameF.push(['FRASLE'])

or just remove the [0] when accessing the value.

Next: You are trying to access inputVal like it is a 2D array, but it is not. It's an array of object. You need to access the keys per element instead.

From:

  for (let i = 0; i < inputVal.length; i++) {
    let id = inputVal[i][0];
    let qty = inputVal[i][1];
    let prodN = inputVal[i][2];

    inputFinal.push([id, qty, prodN])
  }

To:

  for (let i = 0; i < inputVal.length; i++) {
    let id = inputVal[i].id;
    let qty = inputVal[i].qty;
    let prodN = inputVal[i].pName;

    inputFinal.push([id, qty, prodN])
  }

Script Output:

final output

You should now be able to use this to setValues()

sheet.getRange(1, 1, inputFinal.length, inputFinal[0].length).setValues(inputFinal);

output