Skip to main content

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.

Related Blog Posts
No blog post yet for this feature — coming soon.
In the meantime, browse the PDF4me blog for tutorials and workflows across every platform.
Visit the blog

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

The real field names differ from generic docs
The screenshot confirms the main panel uses Protection Password (not "Password"), Workbook Password (not "Protect Workbook Password"), Worksheet Password (not "Worksheet Protection Password"), and Protection Type (not "Worksheet Protection Type").
An empty level-specific password falls back to Protection Password
If Protect Workbook or Protect Worksheets is Yes but the matching Workbook Password or Worksheet Password is empty, the action reuses Protection Password. Set a shared password once or independent ones per level.
Worksheet targeting is 0-based and lives under Advanced parameters
Worksheet Names and Worksheet Indexes are Advanced parameters (confirmed "Showing 2 of 2"). Indexes start at 0 for the first sheet. Leave both empty to protect every worksheet.
Secure Excel action in Power Automate showing File Content and File Name mapped, Protection Password, Protect Workbook set to Yes with Workbook Password, Protect Worksheets set to Yes with Worksheet Password, Protection Type set to All, and the Advanced parameters section showing 2 of 2 with Worksheet Names

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.

ParameterRequiredWhat it doesExample
File ContentRequiredThe source Excel file's content, mapped from a previous action such as Get file content (SharePoint, OneDrive). Accepts .xlsx and .xls.File Content
File NameRequiredThe Excel file name including its extension.test.xlsx
Protection PasswordOptionalPassword 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 WorkbookOptionalYes prevents adding, deleting, renaming, or moving worksheets. No (default) leaves the structure unprotected.Yes
Workbook PasswordConditionalPassword to remove workbook structure protection. Required when Protect Workbook is Yes and Protection Password is empty.12345
Protect WorksheetsOptionalYes locks selected worksheets against content edits. No (default) leaves worksheets unprotected.Yes
Worksheet PasswordConditionalPassword to remove worksheet content protection. Required when Protect Worksheets is Yes and Protection Password is empty.34567
Protection TypeOptionalContents, Objects, Scenarios, or All (default). Controls what a protected worksheet locks.All
Worksheet Names (Advanced)OptionalComma-separated worksheet names to protect. Empty protects all worksheets.Sheet1,Summary
Worksheet Indexes (Advanced)Optional0-based comma-separated worksheet indexes to protect. Empty protects all worksheets.0,2

Protection Type values

Contents
Protects cell values, formulas, and formatting from editing.
Objects
Protects charts, images, shapes, and drawings from being moved, resized, or deleted.
Scenarios
Protects what-if analysis scenarios from being created or modified.
All
Default. Contents plus Objects plus Scenarios together, full read-only protection.

How Do I Set Up Secure Excel in Power Automate?

  1. Add Secure Excel to your flow as a new step.
  2. Sign in to PDF4me Connect with your API key.
  3. Map File Content from a previous action and set File Name with the .xlsx extension.
  4. To encrypt the file: set Protection Password.
  5. To lock structure: set Protect Workbook to Yes and provide Workbook Password (or leave empty to fall back to Protection Password).
  6. To lock cell content: set Protect Worksheets to Yes, provide Worksheet Password, and pick a Protection Type.
  7. Under Advanced parameters, optionally set Worksheet Names or Worksheet Indexes to target specific sheets.
  8. Run the flow, check Success, then route the returned document to SharePoint, OneDrive, or an email attachment.

Output

FieldTypeDescription
documentBase64Excel file with the requested protection levels applied.
SuccessBooleantrue if the operation succeeded, false if it failed.
ErrorMessageStringError description, null when Success is true.
ErrorsArrayDetailed error entries, empty when Success is true.

Common Error Messages

Error messageCauseSolution
Request is emptyRequest object is nullProvide a valid request object
Document is emptyDocument object is nullProvide a valid Excel document
Password is required for workbook protectionProtect Workbook is Yes but both Workbook Password and Protection Password are emptyProvide Workbook Password or Protection Password
Password is required for worksheet protectionProtect Worksheets is Yes but both Worksheet Password and Protection Password are emptyProvide Worksheet Password or Protection Password
Invalid worksheet selectionA worksheet name does not exist or an index is out of rangeUse valid worksheet names or 0-based indexes

Typical Setups

Confidential report, all three levels
  1. Trigger when a financial report is finalized in SharePoint.
  2. Set Protection Password to encrypt the file.
  3. Set Protect Workbook Yes and Protect Worksheets Yes with Protection Type All.
  4. Email the file and its password(s) through separate channels.
Template structure lock, editable input
  1. Trigger on new employee onboarding.
  2. Leave Protection Password empty (open freely).
  3. Set Protect Workbook Yes with a Workbook Password.
  4. Set Protect Worksheets Yes on the "Calculations" sheet only via Worksheet Names, leaving "Input" editable.
Read-only weekly report
  1. Trigger on a weekly schedule after report generation.
  2. Set Protect Worksheets Yes with Protection Type All, leave Worksheet Password empty to fall back to Protection Password.
  3. Distribute the read-only report to the team.

Practical Tips

Never send the password in the same message as the file

Deliver the secured Excel file and its password(s) through separate channels, so intercepting one does not expose both.

Remember the fallback before assuming a password is missing

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.

Worksheet indexes start at 0, not 1

The first worksheet is index 0. Double-check off-by-one errors when scripting Worksheet Indexes from a dynamic list.

Use different passwords per level for layered security

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.

Target specific sheets instead of protecting the whole workbook

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

GoalProtection PasswordProtect WorkbookProtect Worksheets
Maximum lockdownSetYesYes (Protection Type All)
Template structure onlyEmptyYesNo
Read-only content, open accessEmptyNoYes (Protection Type All)
Selective reference-sheet lockEmptyNoYes (target via Worksheet Names)

Common Questions

What is the difference between Protection Password, Workbook Password, and Worksheet Password?+
Protection Password encrypts the whole file, a password is needed just to open it. Workbook Password gates structure changes (adding, deleting, renaming, or moving sheets). Worksheet Password gates content changes on protected sheets (editing cells, changing formats). Each is independent; leaving a level-specific password empty falls back to Protection Password if one is set. See Microsoft's own guidance on protecting an Excel workbook for the underlying protection model.
What do the four Protection Type values (Contents, Objects, Scenarios, All) control?+
Contents protects cell values, formulas, and formatting. Objects protects charts, images, shapes, and drawings from being moved, resized, or deleted. Scenarios protects what-if analysis scenarios from being created or modified. All applies Contents plus Objects plus Scenarios together, the default full-protection choice for most read-only distribution.
Are Worksheet Names and Worksheet Indexes Advanced parameters?+
Yes, both live under Advanced parameters in the Power Automate connector UI, confirmed as Showing 2 of 2 in the panel. Leave both empty to protect every worksheet, or set one to target specific sheets by name or by 0-based index.
Can I protect worksheet content without requiring a password to open the file?+
Yes. Leave Protection Password empty and set only Protect Worksheets to Yes with a Worksheet Password. Anyone can open the file, but protected sheets stay locked against edits until the worksheet password is entered to unprotect them.

Same Task on Other Platforms

Get Help