full-path / ridesheet

Google apps script support for a Google Sheets-based demand-responsive trip scheduling and reporting system.
MIT License
5 stars 4 forks source link

Consider managing column-based event triggers in developer metadata instead of named ranges #122

Open keviniano opened 4 months ago

keviniano commented 4 months ago

RideSheet has the ability to run GAS functions based on whether a cell is within an arbitrary named range. This makes it fairly easy to add functionality by creating a named range with a specifically crafted name that closely mirrors the function call name. For example, named ranges codeFormatAddress1, codeFormatAddress2, etc. will call the function codeFormatAddress.

While this approach has the benefit of making it easy to add functionality to a new column, it is also somewhat brittle. RideSheet basically rebuilds named ranges every time it opens because user changes can easily change named ranges.

A possibly better way to handle things is to associate columns with code through developer metadata. This would require that event triggers be entered into a config file (currently constants.js or constants_local.js) but would be less prone to functionality being disrupted by user activity. It also aesthetically may be a better place to put things, decluttering named ranges.