splits Sheet code, Spreadsheet code, and validation-related code into separate modules
moves relevant functions out of lib and main into respective modules
makes "setup" functions accept an existing Sheet or Spreadsheet as argument rather than creating them
it also adds code to the main entrypoint to create a "PEMM" custom menu with options to call functions that:
set up the sheet the user is currently viewing
apply data validation to all sheets
set up all sheets in the spreadsheet, creating those that don't exist, and also apply validation
testing
to test this, you can follow the instructions in the README, which has been updated to reflect the new setup workflow. this will create a new sheet in your drive and install the menu & other code, but won't apply the schema or validation yet. you can proceed to import data from CSV or edit the sheet yourself, then choose one of the options from the "PEMM" dropdown menu.
notes
some functions can be slow - sheets will show a "Running script" note at the top; the function isn't finished running until this goes away.
the "PEMM" menu may also take a moment to appear after the user loads the spreadsheet; often you will get a "Running script" or similar dialog for a bit while the script runs that creates the menu.
actions like creating named ranges and data validation rules appear to already be idempotent in google sheets, so there's no drawback to running these functions multiple times (except that a new row of headers will be created each time).
changes
this PR refactors existing code:
Sheet
code,Spreadsheet
code, and validation-related code into separate moduleslib
andmain
into respective modulesSheet
orSpreadsheet
as argument rather than creating themit also adds code to the
main
entrypoint to create a "PEMM" custom menu with options to call functions that:testing
to test this, you can follow the instructions in the README, which has been updated to reflect the new setup workflow. this will create a new sheet in your drive and install the menu & other code, but won't apply the schema or validation yet. you can proceed to import data from CSV or edit the sheet yourself, then choose one of the options from the "PEMM" dropdown menu.
notes
some functions can be slow - sheets will show a "Running script" note at the top; the function isn't finished running until this goes away.
the "PEMM" menu may also take a moment to appear after the user loads the spreadsheet; often you will get a "Running script" or similar dialog for a bit while the script runs that creates the menu.
actions like creating named ranges and data validation rules appear to already be idempotent in google sheets, so there's no drawback to running these functions multiple times (except that a new row of headers will be created each time).