I'm writing an SSIS package to import the contents of several Excel files into a SQL Server database for my client. These files will be provided regularly and the system should be completely automated without user involvement.
The Excel files are provided by my client's business partners, so I don't have a lot of control over them.
One of the files seems to be in the Excel 2003 SpreadsheetML XML format. Note that this is different from Open XML. It seems from my research that SSIS cannot read this format. It can and does read "normal" Excel 2003 files just fine.
Does anyone know of a way (in code) to convert this file into either non-XML Excel 2003 or Excel 2007 so I can import it? It needs to be automated, so opening the file using Excel and "save as" another type is off the table.
Related
After creating a dynamic Excel connection manager with Visual Studio 2015 SSIS and iterating through multiple Excel files in a directory I have run into the problem of not being able to change the number of columns in the connection manager. The Excel files do not have the same number of columns (or heading names/locations). I'm passing the data from the connection manager straight into a script component in order to handle this.
I tried creating an Excel connection manager with more columns they I will ever use before switching it to a Package Connection and setting the Expressions ExcelFilePath to my For/Each loop variable but this doesn't seem to work. I've received the VS_NEEDSNEWMETADATA error after this and, after rebuilding, received a
"Column "F18" cannot be found at the datasource"
error when an Excel sheet with fewer than 18 columns was passed through the for/each loop.
Any suggestions or assistance would be appreciated. Thank you.
If the columns count are different between Excel files, you cannot use the same Excel source to import them. You will always get theĆVS_NEEDSNEWMETADATA exception that you mentioned.
If you are handling Excel files with same structure but with different columns order you can refer to my detailed answer on the link below:
Importing excel files having variable headers
If you have the choice to convert Excel files to Flat files, there are many links that describe the full process on how to import files with different structure.
If you don't have this choice, you must think on automating packages creation which is more complex (using BIML or DTS wrappers)
Update 1
Some links about converting Excel to csv:
Script task for converting Excel to CSV
Convert XLS to CSV on command line
Auto convert Xls to CSV
Convert xlsx file to csv using batch
Batch convert xls-Files to csv
SSIS process for saving .xlsx file as .csv file
SSIS using Script task - Convert XLS to CSV
I build SSRS reports in Visual Studio 2013 and I have to use excel file as data source. Each month new .xlsx file is uploaded into the folder of the following structure: \\[yyyy-yy]\[yyyy.mm]\{somefilename}[ mmm yy].xlsx.
Is it possible to specify SSRS data source conditionally, so it will pick up the latest file available?
P.S. I know that the best solution would be a stored procedure on SQL side to pump all data to server, but unfortunately this is not the case.
I have an SSRS report that exports to Excel in xlsx format. I'm trying to then use SSIS to export a large dataset as a new tab to that report, but when I try to use the SSRS exported xlsx file as an Excel Destination in SSIS I get a bunch of errors and it won't recognize the source.
But, if i open the xlsx file exported from SSRS and manually save it again as xlsx, then it will work.
Any idea why this is happening? Is it not possible to use an SSRS exported xlsx file as an Excel Destination in SSIS?
Thanks.
I faced the same issue after using a SSRS-exported excel file as Excel Source in SSIS. It seems SSRS encode the file and include several SSRS specific characters that Excel doesn't interpret and aren't visible from Excel.
You can export the report as a plain text file then use a Flat file connection to flow the data.
Let me know if this helps you.
What's the correct way of exporting data from Excel 2013 file to SQL Server database? The data from the Excel file should be transferred into SQL when saving excel file to a database.
I know many answers for this are available but my question is bit different: every time the excel data changes, or the user clicks on save button the data in the database also needs to be updated.
The easiest way to do this is with an SSIS package. SSIS (SQL Server Integration Services) is a package built in to SQL which allows transformations between data formats.
You can create a package by right-clicking on your target database in SQL Server Management Studio and selecting Tasks > Import Data. In the wizard that comes up asking for a data source choose "Microsoft Excel" from the top drop-down labelled as Data Source, then follow the wizard through. You'll have the choice of importing the Excel data into a new table or mapping it into an existing table.
If you want do this programmatically, you can save your package at the end of the wizard and then invoke it via code. But that's a different question.
What you want is not possible (as long as I know off). You can use SSIS package to migrate the Excel sheet into SQL Server, but is imposible to determine if someone "click save" or do some changes on the excel file. SSIS package can be programed to run on schedule or by demand. You should investigate SSIS packages. It is not easy to learn, but do what you need.
Maybe you would like to try a tool I have developed? It's an Excel Add-In that exports Excel data to SQL Server.
There is a feature to automatically export the data to SQL Server every time you press the save button in Excel. If you need to update the database every time a cell value change, you will need to add a few lines of VBA-code that will push the data to SQL Server.
To beta testers I currently give away a free license, so if you are interested in testing it out, send me an email:)
www.sqlpreads.com
i received an excel workbook and opened it but could not see it unless I went into PowerPivot. Why? It is an XLSX file. I should be able to see it in regular excel.
PowerPivot data is saved within the XSLX file, but not in a regular spreadsheet. PowerPivot uses a different format for its data that is optimized for fast analysis of large data sets, but not for standard Excel operations like putting a formula somewhere into a cell etc. which you can do in normal Excel sheets.
Hence, these being different types of objects, you cannot see them at the same place when opening the Excel file.
If you have MS-Office 2003 or earlier goto the blow link and download and install the MS-Compatibility pack.
http://www.microsoft.com/downloads/details.aspx?FamilyId=941B3470-3AE9-4AEE-8F43-C6BB74CD1466&displaylang=en