How to set password to Xlsb file
Sheetize XLSB Password Setter for .NET provides a simple yet powerful API for applying password protection to an Excel binary workbook while preserving all worksheets, charts, and formatting. This is useful when you need to secure a file before sharing it or integrating it into pipelines that require encrypted Excel files.
Main Features
Apply Password to XLSB
Encrypt an existing XLSB file with a user‑defined password. The protection covers opening the file, and optional restrictions on editing, printing, and structure.
Preserve Formatting & Objects
All cell styles, formulas, tables, charts, and images remain intact after encryption.
Streaming Support
Protect large workbooks in a streaming fashion to keep memory usage low, ideal for batch processing of many files.
Detailed Instructions
XLSB Password‑Protection Workflow
To set a password on an XLSB file with Sheetize, follow these steps:
- Initialize the Protector: Create an instance of
SpreadsheetLocker. - Configure Options: Set
LockerSaveOptionswith the desired password and protection flags (e.g., allow editing objects, allow printing). - Define File Paths: Provide the source XLSB path and the destination protected XLSB location.
- Execute Protection: Call
Processwith the prepared load and protection options.
Example – Unlock an XLSB file with a password
using Sheetize;
var loadOptions = new UnlockerLoadOptions
{
InputFile = "Baby_growth_tracker.xlsx",
Password = "Test"
};
var saveOptions = new SaveOptions
{
OutputFile = "E:\\",
};
SpreadsheetUnlocker.Process(loadOptions, saveOptions);Example – Unlock an XLSB file with a write‑protection password
using Sheetize;
var loadOptions = new UnlockerLoadOptions
{
InputFile = "Baby_growth_tracker.xlsx",
PasswordOfWriteProtection = "Test"
};
var saveOptions = new SaveOptions
{
OutputFile = "E:\\",
};
SpreadsheetUnlocker.Process(loadOptions, saveOptions);Expanded Format Support
- Sheetize can also apply password protection to CSV, TSV, and HTML exports generated from a workbook (the resulting files are wrapped in a ZIP with encryption).
With these capabilities, Sheetize makes XLSB password protection effortless, whether you need a quick one‑off script or a production‑grade service that secures thousands of spreadsheets daily.