There is a collection of data which needs to be shown in the spreadsheet. I mean data will have values for each row(in this case Row 1, Row 2 etc). I need to show them in the spreadsheet. How could i show those data to their respective row name. I could only find the range up to where data will be plotted.
Here is how i have done
function plotData() {
var data = [
{
"Row1": "Row1 Data",
"Row7": 5,
"WillNotBeInOther": 0.75
},
{
"Row2": 5000,
"Row3": 0,
"Row4": 5000,
"Row5": null,
"Row6": 5,
"Row7": null,
"Row8": 0.25,
"Row9": 0,
"Row10": 0
},
{
"Row2": 6000,
"Row3": 20000,
"Row4": 26000,
"Row5": null,
"Row6": null,
"Row7": null,
"Row8": null,
"Row9": 0,
"Row10": 0
},
{
"Row2": 7000,
"Row3": 1000,
"Row4": 8000,
"Row5": null,
"Row6": null,
"Row7": null,
"Row8": null,
"Row9": 0,
"Row10": 0
}
]
var activeSheet = SpreadsheetApp.getActiveSpreadsheet();
var sheetname = "PlotData";
var sheet = activeSheet.getSheetByName(sheetname);
var startRow = 4;
var lastRow = sheet.getLastRow();
var plottableSheetRange = sheet.getRange(startRow, 3, lastRow-startRow+1, data.length);
plottableSheetRange.setValue(10)
}
Here is the spreadsheet where I am working on
https://docs.google.com/spreadsheets/d/1tLNZv4F4lpBAnmHN5H0pBiirW4MVIfTexll9jPA03hI/edit#gid=0
code.gs is the script.
It should look like this
data
might be corresponding to the column number. But at the first index ofdata
, it seems that"Row7": 5
and"WillNotBeInOther": 0.75
of{"Row1": "Row1 Data", "Row7": 5, "WillNotBeInOther": 0.75},
are not used. So can you explain about the logic for convertingdata
to the values for putting to Spreadsheet? – Tanaike{"Row1": "Row1 Data", "Row7": 5, "WillNotBeInOther": 0.75}
has not any other column that is listed in the sheet so other than Row1 others are not filled. – Serenity{"Row1": "Row1 Data", "Row7": 5, "WillNotBeInOther": 0.75}
,"Row1": "Row1 Data"
is used. But"Row7": 5
and"WillNotBeInOther": 0.75
are not used. I cannot understand about the logic for this situation. – Tanaike