This question is about Google spreadsheet. I have a spreadsheet that shares with multiple people. I'm using a script to update the sheet contents as the well. My question is when I running the script, is there a way to protect the sheet against others to edit it. And when the script done, editing permission can be granted back to users again?
相关问题
- How can I force all files in a folder to be owned
- Google Apps Script: testing doPost() with cURL
- Google Apps Script to turn in, grade, and return a
- Script fails on SpreadsheetApp.openById - Requires
- Split Lines and Bold Text within a ui.alert Window
相关文章
- How to allow access for importrange function via a
- Google app script trigger not working
- Set Date/Time to 00:00:00
- indexOf returning -1 despite object being in the a
- Using MIN() inside ARRAYFORMULA()
- How can my Google Apps Script be run by others the
- Google Spreadsheet COUNTIF formula equivalent with
- In Google Sheets how to reference infinite rows in
I'm only replying because I see you haven't had any others yet, and I've tinkered with this very issue without success. Though in my case the objective was somewhat different in that I needed my code to be executed by users when they ran menu-driven scripts. Since you only need to modify the protection yourself, then you might find this works for you.
In any case, I can forsee a situation where users may be mid-edit when you run your code, which could prove frustrating for them! What you might want to do is to get to grips with the User Object and associated methods in order to manage them. Right now I can't see how you would do that without kicking them out (same result), but maybe someone else will chime in with some thoughts. Take a look over the Spreadsheet Class for the following:
https://developers.google.com/apps-script/reference/spreadsheet/spreadsheet
Below is a function I made which worked for me (owner), but not for users - hope it helps: