Home > Software engineering >  I can't hide the last column of a Google Sheet using Google Apps scripts
I can't hide the last column of a Google Sheet using Google Apps scripts

Time:11-29

I have this sheet that I need to modify using a script as I am producing a large number of sheets and can't do each one manually:

This is the code I am using that is supposed to hide the last column "AA" from the sheet beside some other things:

code

Every line is working as expected except the one where I try to hide column AA is producing this error and I've already tried a lot of variations to this line all resulting to this error:

Exception: Those columns are out of bounds.

CodePudding user response:

As mentioned by Yuri Khristich, using SpreadsheetApp.flush() before attempting to hide the last column in the sheet worked.

  • Related