# Scripts, scripts, scripts!

**URL:** <https://community.glideapps.com/t/scripts-scripts-scripts/18965>\
**Category:** Ask for Help\
**Created:** [November 26, 2020, 6:15pm UTC](https://community.glideapps.com/t/scripts-scripts-scripts/18965 "2020-11-26T18:15:21Z")\
**Posts on this page:** 1\
**Showing post:** 54

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [December 31, 2020, 5:32pm UTC](https://community.glideapps.com/t/scripts-scripts-scripts/18965/54 "2020-12-31T17:32:08Z")

</div>

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 🙂

> [@Eric\_Penn](#):
>
> More than getting it to work I’d like to understand the problem. As far as I can tell this means I haven’t declared the variable I am trying to get the value from?

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.

---

_[View the full topic](https://community.glideapps.com/t/scripts-scripts-scripts/18965)._
