# Importing password-protected xlsx

**URL:** <https://community.easymorph.com/t/importing-password-protected-xlsx/373>\
**Category:** General Q&A\
**Created:** [December 13, 2017, 9:50am UTC](https://community.easymorph.com/t/importing-password-protected-xlsx/373 "2017-12-13T09:50:47Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![alistairhay](https://community.easymorph.com/user_avatar/community.easymorph.com/alistairhay/32/100_2.png) [@alistairhay](https://community.easymorph.com/u/alistairhay)\
**Post date:** [December 13, 2017, 9:50am UTC](https://community.easymorph.com/t/importing-password-protected-xlsx/373/1 "2017-12-13T09:50:48Z")

</div>

Hi all,

Has anyone had any experience trying to import a password-protected xlsx file?

I'm currently faced with the error message: 'File has wrong format. End of Central Directory record could not be found. Worksheet name cannot be changed.'

Has anyone any suggestions?

---

<div class="post-metadata">

**Author:** ![dgudkov](https://community.easymorph.com/user_avatar/community.easymorph.com/dgudkov/32/5_2.png) [@dgudkov](https://community.easymorph.com/u/dgudkov)\
**Post date:** [December 14, 2017, 1:47am UTC](https://community.easymorph.com/t/importing-password-protected-xlsx/373/2 "2017-12-14T01:47:24Z")

</div>

Apparently, EasyMorph can't load password-protected Excel workbooks at this point.

I did a bit of research -- it's possible to remove/disable the password using a VBA macro. The macro can reside in another workbook, which gets executed from the command line [[hint](https://stackoverflow.com/questions/2050505/way-to-run-excel-macros-from-command-line-or-batch-file)].

Alternatively, this can be done using a PowerShell script, something like that ( **not tested!** ):

```
$excel = new-object -comobject excel.application
$workbook = $excel.workbooks.open("C:\myfile.xls",0,$False,1,"password")
$workbook.Password = ""
$workbook.save()
$workbook.close()
$excel.quit()

```

In v3.7 there is the PowerShell transformation that can be used for running PowerShell commands. Or simply run a script from command line using "RunProgram" and PowerShell executable.

Once the password is removed the workbook can be loaded in EasyMorph in a regular way.

---

<div class="post-metadata">

**Author:** ![dgudkov](https://community.easymorph.com/user_avatar/community.easymorph.com/dgudkov/32/5_2.png) [@dgudkov](https://community.easymorph.com/u/dgudkov)\
**Post date:** [December 14, 2017, 1:56am UTC](https://community.easymorph.com/t/importing-password-protected-xlsx/373/3 "2017-12-14T01:56:09Z")

</div>

Actually, the script does work 🙂

Here a working example (v3.7+ required).

[remove workbook protection.morph](https://community.easymorph.com/uploads/default/original/1X/10d387c3a69d522d880f883e93a09eb73165edd5.morph) (1.5 KB)

 ![image](https://community.easymorph.com/uploads/default/original/1X/bdabc0a07579b00bbba79a35f9c961a70edfa2c4.png)

---

<div class="post-metadata">

**Author:** ![alistairhay](https://community.easymorph.com/user_avatar/community.easymorph.com/alistairhay/32/100_2.png) [@alistairhay](https://community.easymorph.com/u/alistairhay)\
**Post date:** [December 14, 2017, 8:17am UTC](https://community.easymorph.com/t/importing-password-protected-xlsx/373/4 "2017-12-14T08:17:52Z")

</div>

Cheers Dmitry!

---

<div class="post-metadata">

**Author:** ![Tanner.Hart](https://community.easymorph.com/letter_avatar_proxy/v4/letter/t/9dc877/32.png) [@Tanner.Hart](https://community.easymorph.com/u/Tanner.Hart)\
**Post date:** [June 7, 2021, 4:44pm UTC](https://community.easymorph.com/t/importing-password-protected-xlsx/373/6 "2021-06-07T16:44:14Z")

</div>

Hey @dgudkov

Has there been any advancement on the best way to accomplish this or is the PowerShell script referenced above still the best way?

I have an additional wrinkle. Is there a way to insert the {File} and {Password} from columns available from the previous action? I am using "Get File" to generate a list of files in a certain location, then "Filter by Condition" to only have the one file I want to process through the Morph, and then "Calculate New Column(s)" to create the password (that changes monthly to reflect the date in the password). The PowerShell action would come after the "Calculate New Column(s)".

Any help here would be very appreciated.

Thanks!

---

<div class="post-metadata">

**Author:** ![dgudkov](https://community.easymorph.com/user_avatar/community.easymorph.com/dgudkov/32/5_2.png) [@dgudkov](https://community.easymorph.com/u/dgudkov)\
**Post date:** [June 7, 2021, 5:07pm UTC](https://community.easymorph.com/t/importing-password-protected-xlsx/373/7 "2021-06-07T17:07:52Z")

</div>

Hi Tanner,

> [@Tanner.Hart](#):
>
> Has there been any advancement on the best way to accomplish this or is the PowerShell script referenced above still the best way?

The reply above is still there recommended way.

> [@Tanner.Hart](#):
>
> Is there a way to insert the {File} and {Password} from columns available from the previous action? I am using “Get File” to generate a list of files in a certain location, then “Filter by Condition” to only have the one file I want to process through the Morph, and then “Calculate New Column(s)” to create the password (that changes monthly to reflect the date in the password). The PowerShell action would come after the “Calculate New Column(s)”.

Move the "PowerShell" action into a new module and use the "Iterate" action to run that module once. Define a parameter (e.g. "Password") in the iterated module and assign it with a column value in the "Iterate" action. If you're new to iterations, check out this tutorial: [EasyMorph | Loops and iterations](https://easymorph.com/learn/iterations.html)

---

<div class="post-metadata">

**Author:** ![Tanner.Hart](https://community.easymorph.com/letter_avatar_proxy/v4/letter/t/9dc877/32.png) [@Tanner.Hart](https://community.easymorph.com/u/Tanner.Hart)\
**Post date:** [June 7, 2021, 9:41pm UTC](https://community.easymorph.com/t/importing-password-protected-xlsx/373/8 "2021-06-07T21:41:28Z")

</div>

Worked perfectly iterating the script as its own module.

Thanks for your help Dmitry!

---

<div class="post-metadata">

**Author:** ![dgudkov](https://community.easymorph.com/user_avatar/community.easymorph.com/dgudkov/32/5_2.png) [@dgudkov](https://community.easymorph.com/u/dgudkov)\
**Post date:** [June 7, 2021, 10:12pm UTC](https://community.easymorph.com/t/importing-password-protected-xlsx/373/9 "2021-06-07T22:12:42Z")

</div>

You're welcome 🙂
