Open github-actions[bot] opened 1 year ago
Yes. Yes, it should.
The current behavior is that when the sheet's name is changed, trying to run an update -- even with valid Developer Metadata connecting the sheet to an Advanced List -- is that you get a Google App Script error trying to getRange() on a null value (the sheet that can't be found, since it's only known by name).
Need to either switch to storing sheet by ID (can't remember right now why I'm not doing that) or simply assuming that the sheet affected is the sheet on which the Developer Metadata is stored (a pretty reasonable assumption, one would think).
(Ironically, this turned up in a situation where the Advanced List name had also changed, but because that is tracked by ID, not name, it didn't break.)
Yes, use the presence of developer metadata to determine that the sheet should be synced. And then use the location of the comment (which should be stored in developer metadata as well as the range last updated) to identify where that range is now.
Could, perhaps, have two comments, one at TL and one at BR, but not sure what to assume if one of them goes missing entirely.
Perhaps if eiter comments goes missing, fail and require the user to manually select the range to be updated?
https://github.com/groton-school/bb-lists-to-google-sheets/blob/647c55c73bc400111159c0dce88e9ce1db780181/src/Metadata.ts#L35