Locking One Range Instead of the Whole File While a Teammate Works
How range locking in Piskes Sheets lets you claim a section of a shared workbook without protecting the whole file or relying on a disabled button.
Real-time collaboration solves the problem of two people editing the same document at once — you see each other's cursors, changes merge, nobody overwrites the other's work outright. But it doesn't solve a narrower, more specific problem: what if you want to make sure nobody else touches this section while you're mid-calculation, even briefly? Full-file protection is too blunt for that — it locks your collaborators out of the entire workbook, not just the part you're working in. Piskes Sheets instead lets you lock a specific range.
What a range lock does
Select the cells you want to protect — a block of formulas you're actively revising, an input area you don't want a teammate editing while you reconcile it — and lock the range. Other people with access to the file can still see it and work in the rest of the sheet; they just can't edit the locked cells until you release the lock. You can allow specific people through if a lock needs to admit a collaborator rather than block everyone.
Why it's built on the command layer, not a disabled button
The obvious-looking way to build this is to just grey out the locked cells in the UI and stop clicks from landing on them. It's also not good enough: a disabled button doesn't stop someone from selecting the range with the keyboard, pasting into it, or triggering an undo that reaches back into locked territory. A UI-level block only stops the interaction it was specifically written to catch.
Piskes Sheets avoids that gap by building range locks on Univer's own command-layer protection (AddRangeProtectionCommand, with an allowedUsers list, implemented in sheet-permission.ts) rather than a hand-rolled UI restriction. Every edit to a spreadsheet in Univer — typed input, paste, undo, a formula recalculation writing a value — passes through the command layer before it takes effect, so a lock enforced there catches all of them, not just the one input method someone thought to test.
How the lock reaches your teammate's tab
A lock you set needs to show up for everyone else looking at the file, immediately, not just on next reload. That fan-out is handled by a Durable Object, which keeps the current set of locks and pushes changes out to every open tab on the file. Drive's own job in this picture is narrower than it might sound: it tracks who holds the lock and when it expires, specifically so a lock can't outlive a browser tab someone closed without releasing it. You won't come back the next morning to find a range still locked by a session that ended hours ago.
The result is a middle ground prior real-time-editing features didn't cover: not full-file protection, and not character-level merge resolution either, but the ability to claim exactly the section you're working in and know it'll hold.