-1

I am trying to automatically fill in the last row of a Google Sheet into a range from C2:K{{last_row}}. However, I am not sure how to proceed given my following code:

var dataSpreadsheetUrl = "https://docs.google.com/spreadsheets/sjhsak"; 
//make sure this includes the '
var ss = SpreadsheetApp.openByUrl(dataSpreadsheetUrl);
var deck = SlidesApp.getActivePresentation();
var sheet = ss.getSheetByName('Form_Responses');
var values = sheet.getRange('C2:K{{last_row}}').getValues();

How would I do this?

Rafa Guillermo
  • 14,474
  • 3
  • 18
  • 54
cesarteaser
  • 111
  • 1
  • 8
  • It's not clear what you're trying to do. To what range are you wanting to fill data, and from where? – Rafa Guillermo Aug 19 '20 at 12:57
  • Does this answer your question? [Determining the last row in a single column](https://stackoverflow.com/questions/17632165/determining-the-last-row-in-a-single-column) – dwmorrin Aug 20 '20 at 12:16

1 Answers1

0

I am not sure what is your goal, but you must be looking for this:

sheet.getRange(`C2:K${sheet.getLastRow()}`).getValues();

If you want to store values starting from the last row and first column you could do this:

sheet.getRange(sheet.getLastRow()+1,1,values.length,values[0].length).setValues(values);

References:

Marios
  • 26,333
  • 8
  • 32
  • 52