Google Sheets sharing is all or nothing: anyone with access sees everything in the file. This puts a password in front of the spreadsheet itself — sheets stay hidden until the right password is entered, with two levels, a lockout and a log of who tried.
On open, every sheet is hidden and a password dialog appears. Nothing is readable until the password is accepted, and you choose which sheets, if any, stay public to everyone. Auto Lock re-locks the file every five minutes, so a sheet left open on an unattended screen closes itself rather than staying open all afternoon.
There is a user password and an admin password. Users get the working sheets; the admin gets those plus the Access Log, which nobody else can see. That separation is the difference between hiding data from a colleague and knowing who has been looking at it.
Three wrong attempts triggers a five-minute lockout, so the password cannot be brute-forced by repeated tries. Every attempt — successful or not — is logged with the timestamp, the Google account email and the type of access, so the record exists whether or not anyone got in.
The passwords, the number of allowed attempts and the lockout duration are all configurable at the top of the script. There is no add-on to install, no marketplace extension and no subscription — the code is pasted into the sheet's own Apps Script editor.
A practical note: this protects the spreadsheet interface, not the underlying file permissions. Keep the file itself shared only with people who should have it, and use this to control what they see once inside.
| Version | v1.0 |
| Published | Feb 19, 2026 |
| Platform | Google Apps Script |
| Database | Google Sheets |
| Category | Tools & Utilities |
| Tags | |
| Video | Watch walkthrough |
| License | Regular License |
Subscribe on YouTube, then verify with one click. No payment, no card. Google is used only to confirm your subscription.
What you get
Not subscribed yet? Subscribe to our channel
Extra modules, your branding, integrations or reports built on top of this file. You get a clear quote and timeline before any work starts, and support after delivery.
What We Customize
20-30% advance to start • Clear quote before work begins • Support included after delivery
Paid picks from the same category
What buyers and viewers say about How to Password Protect Google Sheets Using Apps Script (Free Code) | E40.