I have a google sheets with a menu a calling a script. The script is saved separately as Library with a saved version. This Sheet is saved on a shared drive as Google domain template. The users create about 10 sheets a week and have each time to authorize the script.
Which solutions are available to avoid this recurring process. Add-on doesn't seem to be the right solution as the script has to work only for this Spreadsheet
function onEdit(e) {
const rangeName="A2";
var ass=SpreadsheetApp.getActiveSpreadsheet();
var as=ass.getActiveSheet();
var adresse=as.getActiveRange().getA1Notation();
Logger.log(JSON.stringify(e));
if (adresse===rangeName) {
SpreadsheetApp.getActiveSpreadsheet().rename(as.getRange(rangeName).getValue());
ass.toast("DONE!");
}
onEdit
trigger used as a library that is called (if I understand you correctly) via a UI menu? How can this even work? Why can't you just have theonEdit
in the script bound to your spreadsheet? The script wouldn't need authorization at all in this case (also, you could use theonEdit
event object instead of thegetActive
methods. – Iamblichus