I am using ImportXML in a google docs sheet to aqcuire data from the sistrix api. It works fine but I encountered the limitation of 50 ImportXML commands in one sheet. So I used a script that writes the ImportXML command to a cell (temporary) formula and takes back the resulting value of the cell and copies it to the destination cell. So you can do as much ImportXML queries as you need, as they only appear in one temporary cell in the sheet. The problem here is, that the ImportXML query SOMETIMES takes very long or returns with N/A.
Is it possible that my script sometimes doesnt wait for the ImportXML query to return and so the result is corrupted? I am currently doing it in this way:
function GetFormulaData(formula, sheet, row, col)
{
// write the formula (ImportXML(...)) to the specified cell
sheet.getRange(row, col).setFormula(formula);
// return the value of this cell resulting from the formula
return sheet.getRange(row, col).getValue();
}
So this can obviously only work if the formula (the ImportXML query) is done and has written the return value into the cell, so I can read afterwards.
Does anybody have experience or alternatives with calling ImportXML from a script?