I have set up a simple spreadsheet with cells containing a drop down list of Yes
and No
.
I want to lock these cells based on date, so that all the people who I am sharing the sheet with will not be able to edit them after the passing of a certain date.
Can this be done?
(If I can set up the same condition, but based on a certain time on that date will be great. But that's not totally necessary.)
Best Answer
I've created a script that does what you ask for. But since you can't invoke "Undo" with script it starts with copying your data to a separate sheet (called "scriptSheet"), which you have to create. You can hide it after that. This copying happens every time you open your spreadsheet.
When you edit a cell in a specified range the script checks if a date and time specified by you has passed, if it has it informs the user and copies the value from the scriptSheet. If the date hasn't passed the value is instead copied into the scriptSheet.
So here's the script:
Right now the date is retrieved from a cell (
F2
) as stated in the comment on row 19 you can write the date in the script instead. The cell reference just makes it easier to change the date.