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

6

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

excel
reporting-services
ssis
dataflowtask
asked on Stack Overflow Dec 11, 2014 by Doolius • edited Dec 12, 2014 by Doolius

2 Answers

0

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.

answered on Stack Overflow Apr 23, 2021 by variable
-2

Does the ConnectionString property for your Excel Connection Manager look like this?

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=U:\Company Sales 2008.xls;Extended Properties="Excel 8.0;HDR=YES";

Changing it to this should solve your problem:

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=U:\Company Sales 2008.xls;Extended Properties="Excel 12.0 XML;HDR=NO";
answered on Stack Overflow Dec 12, 2014 by april4181

User contributions licensed under CC BY-SA 3.0