Google-sheets – Enabling script to run as author in a shared Google spreadsheet

google sheetsgoogle-apps-script

I created a spreadsheet that I'd like to share with anyone with the URL.

The sheet contains several app script functions. These functions both change the content of the sheet and copy data to another (private) spreadsheet.

How do I get these functions executed even when the sheet is being opened by an anonymous user?

Best Answer

Scripts are run as the user who is viewing the spreadsheet, unless they are published as web applications, in which case you can choose to run the script as the spreadsheet owner.

So, in order to let your anonymous users modify the spreadsheet via a script, you need to give them edit rights, or publish your scripts as a web application, and instruct your users to visit the web application.