DEV Community

Cover image for How to Protect Sheets and Workbooks in a React Spreadsheet
Calvince Moth for Syncfusion, Inc.

Posted on • Originally published at syncfusion.com on

How to Protect Sheets and Workbooks in a React Spreadsheet

TL;DR: Want your React spreadsheets to feel rock‑solid without slowing your users down? Spreadsheet protection gives you the best of both worlds: you can lock down formulas, structure, and layouts while keeping key input cells open for editing. Use sheet protection + protectSettings to decide exactly what users can and can’t do, lockCells() to open just the ranges that matter, and workbook protection to stop sheet renaming, deleting, or moving.

Handling sensitive or business-critical data in the Syncfusion® React Spreadsheet? Protecting sheets and workbooks ensures your templates, formulas, and inputs stay intact and tamper‑free.

This guide walks you through:

  • When to protect a sheet vs. a workbook
  • How to lock/unlock cells
  • How to configure granular permissions
  • How to apply read‑only mode
  • Practical protection patterns for real‑world use cases

Protection features in React Spreadsheet

Syncfusion includes different layers of protection, each for different use cases:

  • Workbook protection: Prevents structural changes like:
    • Adding/removing sheets
    • Renaming or hiding sheets
    • Rearranging sheet order
  • Sheet protection: Restrict editing on the current sheet. Used when:
    • You want formulas protected
    • You want only certain cells to be editable
    • You want users to view but not modify content
  • Cell locking: Lock selected cells or ranges while keeping others editable.
  • Password protection: Secure sheets with a password to prevent unauthorized changes.
  • Selective permissions: Control actions such as inserting/deleting cell data, formatting, resizing rows/columns, and inserting hyperlinks.
  • Read-only mode: Make cells non-editable to prevent modifications.

Ready to lock it down? Explore advanced sheet-protection methods in Syncfusion React Spreadsheet to keep your data secure.

Let’s dive in and see how you can lock sheets, secure cells, protect workbooks, and manage permissions with ease!

Protecting a sheet

The protect sheet feature makes a sheet read-only, preventing edits unless you explicitly allow them. Enable sheet protection by setting the isProtected property to true (it is false by default).

By default, these actions are disabled:

  • Selecting cells
  • Editing cells
  • Formatting rows, columns, or cells
  • Inserting links
  • Resizing, hiding rows/columns

Customizing permissions with protectSettings

The protectSettings option lets you enable specific actions even when a sheet is protected. All options are disabled by default; set to true to enable.

The available protectSettings options are,

  • Select locked cells: Allow selecting locked cells for highlighting.
  • Select unlocked cells: Allow selecting only unlocked cells.
  • Format cells: Apply cell style like font, color, borders, number format, and conditional format.
  • Format rows: Resize and hide Rows.
  • Format columns: Resize and hide Columns.
  • Insert link: Insert hyperlinks in unlocked cells.

For example, if formatCells: true is set in protectSettings, users can still apply styles, borders, and font or background colors even while the sheet is protected.

This article was originally published at Syncfusion.com.

Top comments (0)