I'm looking for the equivalent VBA-GAS of:
Application.ScreenUpdating = False
I'm running a very long macro in one of my Google Spreadsheets and it takes at least 30 seconds to finish it every time. It would be helpful if the macro didn't refresh the screen after every line of code.
There isnt. However you should batch all setValues into range writes (ideally a single range write) which will help here.
Only call SpreadsheetApp.flush() at the very end.
I ended up creating a second sheet called 'Start' which just had A1='Please wait...'. The sheet I display all my data on is called 'Report'
Then used:
//Hide Report sheet
SpreadsheetApp.getActive().getSheetByName("Start").showSheet();
var sheet = SpreadsheetApp.getActive().getSheetByName("Report");
sheet.hideSheet();
//Code to update sheet here
sheet.appendRow('Blah','Blah','Blah');
//Show Report sheet
sheet.showSheet();
SpreadsheetApp.getActive().setActiveSheet(sheet);
SpreadsheetApp.getActive().getSheetByName("Start").hideSheet();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With