The following formula works well with less than 6000 rows. With more than 6000 rows or 100s it fails.
Any suggestions?
function removed() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('test');
var range = sheet.getRange(1, 9, sheet.getLastRow(), 16);
var formulas = range.getFormulas().map(r => r.splice(1));
var values = range.getValues().map(([a, ...b], i) => a == 'Removed' ? b : formulas[i]);
range.offset(0, 1, values.length, 15).setValues(values);
}
The error
Nov 3, 2022, 3:23:12 PM Error Exception: Service Spreadsheets timed out while accessing document with id xxx
at removed(Remove Formula:6:41)
I have also used this variation starting at row 2. Both fail the same way.
function removed() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('test');
var range = sheet.getRange(2, 9, sheet.getLastRow()-1, 16);
var formulas = range.getFormulas().map(r => r.splice(1));
var values = range.getValues().map(([a, ...b], i) => a == 'Removed' ? b : formulas[i]);
range.offset(0, 1, values.length, 15).setValues(values);
}