Pergunta

I have a Google App spreadsheet that I would like to make available to anyone with the link. It uses a custom gui to edit the cells of the spreadsheet. The custom gui is a html file launched using the HtmlService class in the Google Apps Script file.

How can I adjust the settings of the sheet so that anyone can open the spreadsheet and use the custom gui to make changes to the spreadsheet, but not make changes through any other means?

Here are the results I've had under various scenarios.

The gui works as expected but the sheet can be modified without it:

  • Anyone with link can edit
  • Gui launched via custom menu (App script runs as user)

The gui works as expected but the sheet can still be modified without it:

  • Anyone with link can edit
  • Gui launched via installable trigger (App script runs as trigger owner, which is also the document owner)

The gui cannot edit the sheet and neither can users otherwise:

  • Anyone with link can comment
  • Gui launched via installable trigger (App script runs as trigger owner, which is also the document owner)

My thought was that since the installable trigger is running as a user with permissions to change the sheet, that would work. Does that trigger's permissions not extend to a HTML Service gui that it opens?

Foi útil?

Solução

Its not related to htmlServices. Simply any gui that you launch by any means from the spreadsheet will run as the user using the spreadsheet. You need to publish the service (to run as the script owner) and use that gui through its service url, NOT launching it from the spreadsheet (menu etc).

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top