简体   繁体   中英

Google Spreadsheets - why do my scripts work for me the doc owner but not shared editors?

I have a script that adds a 'last modified' date onto a cell in each spreadsheet so I can see when individual spreadsheet of different programs have been updated. It only updates when I update the file not when another person I shared the file with does. I do have the cell locked so no one can delete it by mistake. here is the script i have:

function onEdit(e) {
var d = new Date()
e.source.getActiveSheet()
.getRange('S1')
.setValue('Last Modified:\n' +d
.toLocaleDateString() )
}

I saw an older post on this similar topic that says:

You currently have two triggers: a simple trigger and an installable trigger. Naming a function 'onEdit' (like you did) is already using a simple trigger. A simple trigger can run without the authorization of the user, an installed trigger always need to be authorized by the user. So try removing the installed trigger and see if it then works ?

But I am not sure what the installed trigger is or if I have one? When I look for triggers it says i don't have any. If you have any ideas please let me know. I am volunteering setting up these spreadsheets for a non profit organization and am new to scripting.

Thank you, Amy

Your trigger and script are fine. The issue has everything to do with

I do have the cell locked so no one can delete it by mistake.

You either have to remove the restricted protection from the cell or alter the protection to the warning variety Show a warning when editing this range . Then you should be good to go.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM