You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
returnnull;}constsheet=SpreadsheetApp.getActive().getSheetByName(json.sheet);// TODO should this be resilient to sheet name changes?returnsheet.getRange(json.row,json.column,json.numRows,json.numColumns);}constget=(key: string,sheet?: GoogleAppsScript.Spreadsheet.Sheet)=>{sheet=sheet||SpreadsheetApp.getActive().getActiveSheet();returng.SpreadsheetApp.DeveloperMetadata.get(sheet,key);};exportconstgetList=(sheet?: GoogleAppsScript.Spreadsheet.Sheet): SKY.School.Lists.Metadata=>get(LIST,sheet);exportconstgetRange=(sheet?: GoogleAppsScript.Spreadsheet.Sheet)=>rangeFromJSON(get(RANGE,sheet));exportconstgetLastUpdated=(sheet?: GoogleAppsScript.Spreadsheet.Sheet)=>get(LAST_UPDATED,sheet);constset=(key: string,sheet: GoogleAppsScript.Spreadsheet.Sheet=null,value: any)=>{sheet=sheet||SpreadsheetApp.getActive().getActiveSheet();returng.SpreadsheetApp.DeveloperMetadata.set(sheet,key,value);};exportconstsetList=(list: SKY.School.Lists.Metadata,sheet?: GoogleAppsScript.Spreadsheet.Sheet)=>set(LIST,sheet,list);exportconstsetRange=(range: GoogleAppsScript.Spreadsheet.Range,sheet?: GoogleAppsScript.Spreadsheet.Sheet)=>set(RANGE,sheet,rangeToJSON(range));exportconstsetLastUpdated=(lastUpdated: Date,sheet?: GoogleAppsScript.Spreadsheet.Sheet)=>set(LAST_UPDATED,sheet,lastUpdated.toLocaleString());constremove=(key: string,sheet?: GoogleAppsScript.Spreadsheet.Sheet)=>{sheet=sheet||SpreadsheetApp.getActive().getActiveSheet();returng.SpreadsheetApp.DeveloperMetadata.remove(sheet,key);};exportconstremoveList=remove.bind(null,LIST);exportconstremoveRange=remove.bind(null,RANGE);
The text was updated successfully, but these errors were encountered:
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
The text was updated successfully, but these errors were encountered: