Secure Excel in Power Automate
Secure Excel is a Power Automate action by PDF4me that applies password protection to an Excel file at three independent levels: file encryption (a password to open the file at all), workbook structure protection (locking sheet add, delete, rename, and move), and worksheet content protection (locking cell edits on selected sheets). Use it to distribute confidential financial data, lock a template's structure while leaving input cells editable, or ship a read-only weekly report.
What this action does
PDF4me Secure Excel applies up to three independent protection levels to an Excel file in one call: Protection Password for file encryption, Workbook Password for structure protection, and Worksheet Password plus a Protection Type for cell-content protection on selected sheets. A level-specific password falls back to Protection Password when left empty, so one password can secure all three layers if you prefer.
How Do I Authenticate My Power Automate Flow?
To call PDF4me through Power Automate, the flow needs a valid PDF4me API key on the PDF4me Connect connector. Authentication ensures secure communication and validates your identity as an authorized user.
Important Facts You Should Not Miss
Protection Password (not "Password"), Workbook Password (not "Protect Workbook Password"), Worksheet Password (not "Worksheet Protection Password"), and Protection Type (not "Worksheet Protection Type").
The three password fields (Protection Password, Workbook Password, Worksheet Password) sit in the main panel; Worksheet Names and Worksheet Indexes are under Advanced parameters.
Parameters
Required in the action: File Content and File Name. At least one password is required once its matching protection toggle is Yes, either the level-specific password or Protection Password as a fallback.
| Parameter | Required | What it does | Example |
|---|---|---|---|
| File Content | Required | The source Excel file's content, mapped from a previous action such as Get file content (SharePoint, OneDrive). Accepts .xlsx and .xls. | File Content |
| File Name | Required | The Excel file name including its extension. | test.xlsx |
| Protection Password | Optional | Password required to open the file at all (file encryption). Also used as the fallback for Workbook Password and Worksheet Password when they are left empty. | 56789 |
| Protect Workbook | Optional | Yes prevents adding, deleting, renaming, or moving worksheets. No (default) leaves the structure unprotected. | Yes |
| Workbook Password | Conditional | Password to remove workbook structure protection. Required when Protect Workbook is Yes and Protection Password is empty. | 12345 |
| Protect Worksheets | Optional | Yes locks selected worksheets against content edits. No (default) leaves worksheets unprotected. | Yes |
| Worksheet Password | Conditional | Password to remove worksheet content protection. Required when Protect Worksheets is Yes and Protection Password is empty. | 34567 |
| Protection Type | Optional | Contents, Objects, Scenarios, or All (default). Controls what a protected worksheet locks. | All |
| Worksheet Names (Advanced) | Optional | Comma-separated worksheet names to protect. Empty protects all worksheets. | Sheet1,Summary |
| Worksheet Indexes (Advanced) | Optional | 0-based comma-separated worksheet indexes to protect. Empty protects all worksheets. | 0,2 |
Protection Type values
ContentsObjectsScenariosAllHow Do I Set Up Secure Excel in Power Automate?
- Add Secure Excel to your flow as a new step.
- Sign in to PDF4me Connect with your API key.
- Map File Content from a previous action and set File Name with the
.xlsxextension. - To encrypt the file: set Protection Password.
- To lock structure: set Protect Workbook to Yes and provide Workbook Password (or leave empty to fall back to Protection Password).
- To lock cell content: set Protect Worksheets to Yes, provide Worksheet Password, and pick a Protection Type.
- Under Advanced parameters, optionally set Worksheet Names or Worksheet Indexes to target specific sheets.
- Run the flow, check Success, then route the returned document to SharePoint, OneDrive, or an email attachment.
Output
| Field | Type | Description |
|---|---|---|
| document | Base64 | Excel file with the requested protection levels applied. |
| Success | Boolean | true if the operation succeeded, false if it failed. |
| ErrorMessage | String | Error description, null when Success is true. |
| Errors | Array | Detailed error entries, empty when Success is true. |
Common Error Messages
| Error message | Cause | Solution |
|---|---|---|
Request is empty | Request object is null | Provide a valid request object |
Document is empty | Document object is null | Provide a valid Excel document |
Password is required for workbook protection | Protect Workbook is Yes but both Workbook Password and Protection Password are empty | Provide Workbook Password or Protection Password |
Password is required for worksheet protection | Protect Worksheets is Yes but both Worksheet Password and Protection Password are empty | Provide Worksheet Password or Protection Password |
Invalid worksheet selection | A worksheet name does not exist or an index is out of range | Use valid worksheet names or 0-based indexes |
Typical Setups
- Trigger when a financial report is finalized in SharePoint.
- Set Protection Password to encrypt the file.
- Set Protect Workbook Yes and Protect Worksheets Yes with Protection Type All.
- Email the file and its password(s) through separate channels.
- Trigger on new employee onboarding.
- Leave Protection Password empty (open freely).
- Set Protect Workbook Yes with a Workbook Password.
- Set Protect Worksheets Yes on the "Calculations" sheet only via Worksheet Names, leaving "Input" editable.
- Trigger on a weekly schedule after report generation.
- Set Protect Worksheets Yes with Protection Type All, leave Worksheet Password empty to fall back to Protection Password.
- Distribute the read-only report to the team.
Practical Tips
Deliver the secured Excel file and its password(s) through separate channels, so intercepting one does not expose both.
Leaving Workbook Password or Worksheet Password empty is not an error by itself, the action falls back to Protection Password. Only a request with no usable password at all fails.
The first worksheet is index 0. Double-check off-by-one errors when scripting Worksheet Indexes from a dynamic list.
Reusing Protection Password for every level is convenient, but a reviewer who can open the file can then also unprotect the structure and content. Use independent passwords when different people need different access.
Use Worksheet Names or Worksheet Indexes to lock reference and formula sheets while leaving input sheets open for the team that needs to edit them.
Cheat Sheet
| Goal | Protection Password | Protect Workbook | Protect Worksheets |
|---|---|---|---|
| Maximum lockdown | Set | Yes | Yes (Protection Type All) |
| Template structure only | Empty | Yes | No |
| Read-only content, open access | Empty | No | Yes (Protection Type All) |
| Selective reference-sheet lock | Empty | No | Yes (target via Worksheet Names) |