The script unloading the current price in GoogleSheets works 50/50. Must take the end of the link in column B and upload the data received by the link in column E. The data is unloaded, but through time it pretends that it does not see the desired value on the page. Tell me, what is the error?

function lastBetCost() { var i for(i=0; i<100;i++){ var sheet = SpreadsheetApp.getActiveSheet(); var range = sheet.getRange("b2:f100"); var value = range.getCell(i+1,1).getValue(); var cell = range.getCell(i+1,4) var response = UrlFetchApp.fetch("https://zakupki.mos.ru/api/Cssp/OfferAuction/GetEntity?id="+value); var textResp = response.getContentText(); var start = textResp.indexOf('lastBetCost', end)+13; var end = textResp.indexOf('.', start); var name = textResp.substring(start, end); var lastBetCost =(name + value) cell.setValue(name); } } 

The problem is that a string in the start variable gives the value "12", despite the conditions of textResp. Temporarily cured a problem with

 if (start == 12) { i-=1; } 

Everything worked, but 1: stupidly ugly, 2: the execution time of the script is delayed, 3: I can not sleep while I have a curve script (

    0