I have an Employee attendance register in Google Sheets, wherein I want to lock the particular column/s after the date is passed over.

This feature is required for the clerk to enter the date on the same date or probably the next date, but cannot edit later.

Can somebody please provide a code in which I can patch on script editor.

Attached is the reference image of attendance register.

attendence register

  • It can be done with a script, but is somewhat complicated, so I don't feel like doing that. A simpler solution is to use a Google Form to collect this information. A user who enters data on a form cannot later edit what was submitted. – user79865 Feb 10 '16 at 5:45
  • It's not clear why a Excel screenshot was included in a Google Sheets script request. Please explain this. – Rubén Feb 10 '16 at 13:40
  • By the way, please take the tour and checkout How to Ask. – Rubén Feb 10 '16 at 13:41

Partial answer

The screenshot shows the Excel UI instead of the Google Sheets UI. While Google Sheets could import/export and edit .xlsx files there are some features that are not compatible in one or the other. One of this features is Excel's cell lock.

The way that the assumed OP's logic could be implemented in Google Sheets is by protecting the cell and for doing this with a script, the Class Protection should be used and triggered with an Edit by using a installable trigger, I think.


To learn about how to extend Google Sheets see:
Extending Google Sheets - Google Developers

To learn about the lock cells feature in Excel see:

Lock cells in a worksheet - Microsoft Office Help

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.