lets assume we have a table of 4 x 4 starting from A1, now normally if I want to update it's values at once I'll just do
sheet.getRange("A1:D4").setValues(values);
now if the data is not contiguous so I have 3 4 x 4 separate tables with other data between them but I have them named as named ranged i.e (table1, table2, table3), can I do sth like:
sheet.getNamedRanges([table1range, table2range, table3range]).setValues([table1data, table2data, table3data]);
instead of:
sheet.getRange(table1range).setValues(table1data);
sheet.getRange(table2range).setValues(table2data);
sheet.getRange(table3range).setValues(table3data);
so that now all the 3 tables will be updated in the same operation instead of 3 different operations to save execution time? thank you in advance.
CodePudding user response:
I believe your goal is as follows.
- You want to achieve the script like
sheet.getNamedRanges([table1range, table2range, table3range]).setValues([table1data, table2data, table3data]);in order to reduce the process cost. - Namely, you want to put the values for each range to Google Spreadsheet using Google Apps Script. And, the range is
In this case, I think that Sheets API can be used for achieving your goal as follows. In this case, this thread might be useful. 
