Scripts, scripts, scripts!

How are you calling the function?
It should be something like format_sheet('Sheet 1')

I actually use this within a wrapper function, something like this:

function on_sheet_change(event) {
  var sheetname = event.source.getActiveSheet().getName();
  format_sheet(sheetname);
}

That’s a simple example, normally I’ll have a an if/then/else block that first checks the sheetname, and then only calls the format_sheet() function for selected sheets.

That was the long answer.

The short answer is that error probably indicates that you didn’t give it a sheet name :slightly_smiling_face:

Sorry, just realised that I didn’t address this question directly.
Yes, that’s correct. sheet is null (I assume because of the above), and so when you try and do anything with it (getBandings()), that error is thrown.

1 Like