Releases a lock so other script runs can continue.
class LockService method .releaseLock()
LockService is the Apps Script service.
.releaseLock() is the method name you will see after a dot in your code.
What it does
Why it's used
- Let the next run proceed after yours completes.
- Always pair with waitLock or tryLock in a finally block.
Common errors
- Forgetting parentheses on releaseLock. Write LockService.releaseLock(), not LockService.releaseLock or releaseLock by itself.
- Skipping dots between chained calls. Each step needs a dot, like LockService.releaseLock().
- Adding spaces where they do not belong. Write LockService.releaseLock(), not LockService .releaseLock(), LockService.releaseLock (), or LockService . releaseLock().
- Wrong capitalization. Use LockService and releaseLock, not lockservice or releaselock.
Explore
Related methods
-
.getScriptLock()
Returns a lock shared by all runs of the script.
-
.waitLock()
Waits until the lock is available, then acquires it.
-
.tryLock()
Tries to acquire the lock without waiting.
-
.getUserLock()
Returns a lock private to the current user.
-
.getDocumentLock()
Returns a lock tied to the current spreadsheet or doc.
More Apps Script
Better Sheets tutorials
No tagged tutorials yet. Fetch Apps Script from the harvest table and this page fills automatically.