Can't open excel file with SSIS unless it is manually saved

5k views Asked by At

I'm having an issue processing an excel file with SSIS unless I manually open the file and click 'save'.
I've noticed that it doesn't mater if the file is .xls or .xlsx

The file is downloaded to excel from an SSRS project
I am able use a File System Task to move, rename, delete, etc. the file, but when I try to use a dataflow task to access the contents inside the file I get an error that the external table is not in expected format.
I then have to open up the file, click save, and the file processes fine.

Not sure if this means anything but....
I've noticed that when I open the original file in notepad the top line includes with:

xl/workbook.xml

After I save the file the top line changes to:

[Content_Types].xml 

Using Microsoft Visual Studio 2012.

ERROR:

Error: 0xC0202009 at TransferMoneyReconcile, Connection manager "Excel Connection Manager": SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft Office Access Database Engine" Hresult: 0x80004005 Description: "External table is not in the expected format.".

ExcelConnectionString:

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\192.168.234.567\ftp\Sample\Money\Archive_Transfer Money to Manager.xlsx;Extended Properties="EXCEL 12.0 XML;HDR=NO";

any help/suggestions are appreciated!
Thanks!
Steven

2

There are 2 answers

0
variable On

XLSX extension is of 2 types.

  1. Excel workbook (let's call this type 1)

  2. Strict Open XML Spreadsheet (let's call this type 2)

Both the above have the .xlsx extension.

To see this yourself, you can open the excel application, create a new file, click on save and notice the type 1 (located at top of the list) and type 2 (located at the bottom of the list).

The default option is type 1 - Excel workbook. So when you create a new file and save, it will get saved as type 1.

Based on my testing, however, when you open a type 2 file and save, then it may get saved as type 1 or type 2. This behaviour is not guaranteed.

Anyways, to resolve the error you are facing, open the file and save it (via save as) and choose type 1 format. Then test the SSIS, it should run without the error.

0
Stuart Steedman On

This might throw more light on it. The questions remain:

  • Why can't SSRS output in the standard Excel Workbook format?
  • Why can't SSIS load the Strict Open XML Spreadsheet format?

Before

After