I recently coded a Google Apps Script attached to a Google Sheet. The sheet is a form, and the script sends the form as a pdf attachment to my email, and then clears the data entered by the user so that it's ready to be used again. The script is run when a button on the sheet is clicked (the script is assigned to this button).
I want to share this sheet with my team members so that they can use it freely to submit the form whenever they need. However; I also don't want them to be able to freely edit the sheet and potentially break the functionality. I used the Protected Ranges ability that Google Sheets has to allow the user to only edit the cells required to complete the form. I then realized while testing that the user is still able to click into the Apps Script dropdown under extensions and directly edit the script attached to the spreadsheet. Unfortunately I have read that this is not really avoidable if the user has edit access to the sheet.
I was searching for workarounds and read that I could publish my script as an add-on, and then link the published add-on to the sheet. This way it would not be editable by the sheet user.
My question is if I publish my script as an add-on, will I still be able to link the add-on to a button on the sheet and have the add on triggered when the button is clicked? I find the buttons nice from a UI perspective so I am hoping this is possible, but the only option I can see to link a button when clicking into its options is "Assign Script". Is this possible?