RamblingCookieMonster / PSExcel

A simple Excel PowerShell module

Home Page:http://ramblingcookiemonster.github.io/PSExcel-Intro/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Import-XLSX of certain type of Excel file failing

embreeb0627 opened this issue · comments

I posted this in the Technet forum but I was told to post it here instead:

I am trying to read an Excel spreadsheet that gets automatically generated every morning. It is a feed from Remedy. I can open the file manually with no problems, but I want to use the spreadsheet, which has user info in it, for getting said user info. Every time I use the PSExcel module and use Import-XLSX to read the file, I get the following error:

"Exception calling '.ctor' with '1' argument(s): 'Can not open the package. Package is an OLE compound document"

It's a head scratcher and the only thing I could find was a reference to C# code. I'm not sure what to do, but it's weird that I can open it manually but not using PS. I haven't tried the ImportExcel module but I'm guessing it would be the same result. Any suggestions would be greatly appreciated.
Brian

Hi!

There's a good chance this is a plain old XLS file, even if it's named XLSX. Try opening it in Excel, saving it in the xlsx format, and importing that.

I'm not sure if there's a programmatic way to do that, with a library similar to EPPlus that doesn't rely on Excel.

If you (or anyone else) finds a workaround that might be integrated into this module, would certainly be open to it!

Cheers!

I've begun experiencing this since the rollout of sensitivity labels. If a label above "internal" (i.e. "confidential" or "restricted") is applied to a file then it cannot be opened outside of the origin domain and the error "Can not open the package. Package is an OLE compound document. If this is an encrypted package, please supply the password" is returned. Solution there (for us) is to roll the sensitivity label back to "public" or "internal", or put the machine importing the Excel document into the same domain as where the file originated.