0

I have a chart developed from google app script that references a spreadsheet.

My Data source looks like this

enter image description here

It has blank cells in between representing the holiday period when no recording is done. The source sheet grows daily by 1 row.

Currently my range query is

var range = sheet.getRange(firstrow, 1, sheet.getLastRow() - firstrow + 1, 3);

where the Lastrow is the last row of the google sheet and not the last row of the column data.

is there a way to create a iteration where the range gets dynamically changed based on the last row of of the column Data instead of the actual last row itself.

The result of my current range query gives me an output which looks like this. which adds a 0 to all the non updated rows under my data column

enter image description here

By only obtaining the range based on last row of the column Data, my chart wont have inevitable 0 until last row of the table. Is this possible.

I am just learning to use google app script. Any advice is much appreciated. TIA.

Sai Ram
  • 43
  • 1
  • 9
  • Look at (https://stackoverflow.com/a/17637159/1330560). I use it constantly and it is exactly what you want. – Tedinoz Feb 01 '19 at 05:55
  • 1
    Yup i just discovered it and made use of it and modified my code. After changing to this below code, i managed to realize what i wanted to achieve. var Bvals = sheet.getRange("B8:B").getValues(); var Blast = Bvals.filter(String).length; var range = sheet.getRange(firstrow, 1, Blast+firstrow-1, 3); – Sai Ram Feb 01 '19 at 06:17
  • Suggest that you convert this to an answer (answer your own question - it's OK!) so that future users can easily the solution, understand and apply it. Don't forget to do more than just add the code; add some explanation too. – Tedinoz Feb 04 '19 at 02:50

0 Answers0