question is, how to change this part of the code, to get all columns from the array not only [0,1,2,3]
this is the codeline:
const new_table = [0,1,2,3].map(x => make_row_from_col(this_table, x)).join('\n');
and no, object.keys(this_table) does NOT work, because it does NOT give me all columns back only 4 rows are getting displayed smh.
whole script:
function Test() {
const sSheet = SpreadsheetApp.getActiveSpreadsheet();
const srcSheet = sSheet.getSheetByName("Refinery");
const table = srcSheet.getRange("A:H").getValues(); // use "D2:M" if you have a header
const values_C = table.filter(t => t[7] == "READY TO SELL").map(t => t[0]);
const values_D = table.filter(t => t[7] == "READY TO SELL").map(t => t[1]);
const values_E = table.filter(t => t[7] == "READY TO SELL").map(t => t[2]);
const values_F = table.filter(t => t[7] == "READY TO SELL").map(t => t[3]);
Logger.log(values_C)
Logger.log(values_D)
Logger.log(values_E)
Logger.log(values_F)
Logger.log(values_C.length)
const this_table = [values_C,values_D,values_E,values_F];
const make_row_from_col = (this_table, col) => this_table.map(x => x[col]).join("\t"+"\t"+" | "+"\t"+"\t");
const new_table = Object.keys(this_table).map(x => make_row_from_col(this_table, x)).join('\n');
Logger.log(new_table);
}