I notice that with the addition of several SpreadsheetApp.flush();
, the time it takes the script to finish is absurdly longer, I understand because of the fact that it needs to update the spreadsheet at each end of the functions.
But I need a confirmation of the 100% updated spreadsheet to pass the next function, is the way I'm using it correct or is there a more correct way to work this functionality?
This amount of calls and flushes can cause any problems in walking the script?
function AutomacaoCompleta() {
if (SpreadsheetApp.getActive().getSheetByName('Dados Importados').getRange("A2").getValues()[0][0]=="OK"){
LimparDados();
SpreadsheetApp.flush();
PaginaDoJogo();
SpreadsheetApp.flush();
EstadioDoJogo();
SpreadsheetApp.flush();
MenuDoPlantelTimeA();
SpreadsheetApp.flush();
PlanteldoTimeA();
SpreadsheetApp.flush();
MenuDoPlantelTimeB();
SpreadsheetApp.flush();
PlanteldoTimeB();
SpreadsheetApp.flush();
EstatisticasDoTimeA();
SpreadsheetApp.flush();
EstatisticasDoTimeB();
SpreadsheetApp.flush();
MenuDoPlantelTimeA1();
SpreadsheetApp.flush();
MenuDoPlantelTimeB1();
SpreadsheetApp.flush();
}
}