I recently picked up a google sheets file that would allow me to use the ImportXML more than 50 times in a spreadsheet. https://docs.google.com/spreadsheets/d/1VriaQ6QMq69Ya3734DKRBZ1eUBRd3B1jCD-P6DUHKLA/edit?usp=sharing
I ran into a problem where the script times out because it has to run through so many links (it can't go over 250 at the moment) that it reaches the script run-time limit.
I was wondering if there was a way to turn off the script run-time limit or have it break and restart every 5 minutes. I'm not very good at app script at the moment as I just started learning it, and was hoping someone might be able to point me in the right direction.
I linked the spreadsheet above (with example links for protection reasons). But here is the code im running for the sheet if you would like a look:
function bulkXml() {
var sheet = SpreadsheetApp.getActiveSheet();
var lastRow = sheet.getLastRow()
var Num = sheet.getRange(2, 1, lastRow, 1).getValues();
Num = Num.filter(function(u) {
return u[0].length > 2
})
// Logger.log(a)
// return false
for (var y = 0; y < 2; y++) {
for (var x = 2; x - 2 < Num.length; x++) {
var url = sheet.getRange(x, 1).getValue();
sheet.getRange(2, 6).setValue(url);
var xpathResult = sheet.getRange(3, 6).getValue();
var counter = x - 1;
sheet.getRange("C4").setValue(" PLEASE WAIT...CURRENTLY FETCHING " + counter + " OUT OF " + Num.length);
if (y === 1) {
sheet.getRange(x, 2).setValue(xpathResult);
sheet.getRange("C4").setValue("PROCESSED " + counter + " OUT OF " + Num.length);
SpreadsheetApp.flush();
}
}
}
}