So I have a relatively simple SSIS job that does the following:
Execute SQL Task - Drop Sheet from Excel File
drop table `Table`
Execute SQL Task - Create Sheet in Excel File
CREATE TABLE `Table` (
`Col1` VarChar (255) ,
`Col2` Long ,
`Col3` VarChar (84) ,
`Col4` VarChar (60) ,
`Col5` VarChar (255) ,
`Col6` VarChar (20) ,
`Col7` VarChar (255) ,
`Col8` VarChar (255) ,
`Col9` VarChar(255))
Data Flow Task - Export Data from SQL to Excel
This just runs an SQL query [OLE DB Source], coverts everything to unicode strings, and exports the data to an Excel Destination.
NOTE: This job executes perfectly with no errors in BIDS 2005. However, when I initially tried running it in BIDS 2008 (32 bit mode), I got the following error on both the Drop Sheet and Create Sheet Execute SQL Tasks mentioned above:
Warning: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
I found I could fix this by changing the ConnectionType property of my Execute SQL Tasks to ADO, and using the following connection string:
Data Source=\\<filelocation>\<ExcelFileName>.xls;Provider=Microsoft.ACE.OLEDB.12.0;Extended Properties=Excel 8.0;
At this point, I'm back to the package executing in BIDS 2008 with no errors. Everything runs great!
Then I tried to update the job from exporting to an Excel 97-2003 .xls file to exporting to an Excel 2007 .xlsx file.
So, per Microsoft, I had to change my Execute SQL Tasks to use the following connection string:
Data Source=\\<filelocation>\<ExcelFileName>.xlsx;Provider=Microsoft.ACE.OLEDB.12.0;Extended Properties=Excel 12.0 XML;
I also had to update the connection manager for my Excel Destination step (which DOES support the Excel 2007 format in BIDS 2008 per Microsoft) to the following:
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\<file location>\<Excel filename.xlsx;Extended Properties="Excel 12.0 XML;HDR=YES";
So at this point, all the connections test good, and everything APPEARS like it should work. However, when I execute the package I have the following problem.
- The Drop Sheet Execute SQL Task completes successfully according to BIDS. However, it doesn't actually drop the sheet in the Excel file anymore. It DOES delete all the data contained in the sheet though.
- Because of #1, the Create Sheet Execute SQL Task fails because the sheet was never actually dropped.
Any ideas why this isn't working anymore? Honestly I've looked all over the internet and SO, and I have yet to see someone explain how to do this. Is there some new command to drop a sheet in Excel 2007?