问题
I have 200+ spreadsheet that our customers fill. I developed a script to manage the spreadsheets which is basically identical in function.
The problem is when I modify the script I need to change it in all these sheets. I tried using libraries but with no success and I hoping to hear if someone knows an answer.
The library version I include (with development on) in each spreadsheet does not show the change ensued. It will only show the results at the time of inclusion, which means that in order to make this work I have to go to each of the spreadsheets, remove the library and re-install the most recent version. The updated library only works from my owner's account. The library is of course shared by anyone who has a link. Running a library's updated function in any of the spreadsheets produce an error: "TypeError: Cannot find function FunctionName in object [object Object]. (line 2, file "test")"
Is there a good way to have all spreadsheets same one code that I can change whenever I wish?
回答1:
You should turn on "development mode". Resources -> libraries included for each spreasheet that include the library
回答2:
I have not had much success using library myself.
One solution I would suggest would be to use a standalone script. If the spreadsheets have identical features, you can run the script on all of them using a for loop.
You can get an array of files inside a folder using using getFiles()
// Logs the number of files in the 'kittens' folder
var folder = DocsList.getFolder('kittens');
var files = folder.getFiles();
Logger.log(files.length);
来源:https://stackoverflow.com/questions/15797028/how-to-use-one-code-for-multiple-spreadsheets-that-can-be-updated-attempt-to-us