About EasyMorph Tutorials & Examples Web-help

Importing password-protected xlsx


#1

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?


#2

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].

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.


Htm file - Upload
#3

Actually, the script does work :slight_smile:

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

remove workbook protection.morph (1.5 KB)

image


#4

Cheers Dmitry!