.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

When dynamically creating an excel file, can SSIS create xlsx files successfully? I can only get SSI

Posted By:      Posted Date: October 07, 2010    Points: 0   Category :Sql Server

Problem: An Excel file (XLSX) dynamically created by a SQL Task cannot be opened via Excel. The task succeeds, but when you try to open the workbook in Excel you get the fillowing error message: Excel cannot open the file 'myfile.xlsx" because the file format or file extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file.

1. If the Excel file (xlsx) is created manually in Excel, then the SQL Task has no problem creating table (new worksheets) in the xlsx (so the "CREATE TABLE" statement works fine)
2. If I adjust the connection and task to work with Excel 97-2003 (xls) format then the approach works perfectly
3. The execution results show success of the SQL Task, but there are two warning messages. These same warnings appear when the SQL Task creates a new table (worksheet) successfully in a workbook (xlsx) which was created manually in Excel (and is not corrupt). Messages as follows:
Warning: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
Warning: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.

SSIS Details:
1. ConnectionString: "Data Sour

View Complete Post

More Related Resource Links

Create Excel file dynamically in SSIS package and fill it by resultset data returned by Stored proce


Hello Every One,

I have a scenario in which i am executing a Stored Procedure which returned a result set.

I want to create a Excel file [name_date_time] dynamically, and fill result set data into Excel file. And then finally sent Excel file to Specific user[Email ID].

Point is that the excel file should have unique name so i want to give name as name_date_time.

So every time when package run new file is created with unique name.


Can any one suggest me who to create Excel file and fill result set data into Excel file.

And then finally send that Excel file ?







Creating Multiple Excel files Using SSIS

Hello Friends,  I have to create multiple excel files(Per Year eg 2008 , 2009, 2010....) from datatable using SSIS  For that i have to use one template excel file that is already created on some location.  Any help would be appreciated.  Thanks Thanks

SSIS Excel File Creation Dynamically



I Have 3 rows in Database

EmName Salary

Test1      100

Test2      200

Test3      300

I want to create excel files dynamically with the names as EmpName using SSIS.



Rajesh Kumar Jena

Creating Excel file from C#

I used below coding for create a excel sheet.I got from on web site.
In below coding there is no problem.Its create the excel file.If i run second time,its ask to overwrite the current excel file.If I said "Yes" then it ok ,but If I select cancel button,its generate the Error message.The exception is

Create excel file from Binary data on SqlServer



My requirement is that i upload an excel file then i need to validate that data.


1. Uploading file using using upload control saving binary in SqlServer

2. Then i am creating file from binary data  on Sql Server using below command and then using OPENROWSET to dump data to Sql table

3. Then reading Sql Table row wise and validating data.


Alter Procedure spUploadExcelFile
  @PKID int,
  @BatchID int


	Declare @VarBin varbinary(max)
	Declare @FileName varchar(100)
	DECLARE @sql nvarchar(MAX)
                DECLARE @errMsg nvarchar(MAX)
	DECLARE @ObjectReturn INT
	DECLARE @ErrorSource VARCHAR(255)
	DECLARE @ErrorDesc VARCHAR(255)
	DECLARE @ObjectToken INT

	Select @VarBin  = Content , @FileName = [FileName] from MultilangBinaryData Where PKID = @PKID
	SET @FileName = 'C:\'  + @FileName
	EXEC sp_OACreate 'ADODB.Stream' @ObjectToken OUTPUT
	EXEC sp_OASetProperty @ObjectToken, 'Type', 1
	EXEC sp_OAMethod @ObjectToken, 'Open'
	EXEC sp_OAMethod @ObjectToken, 'Write', NULL, @VarBin
	EXEC sp_OAMethod @ObjectToken, 'SaveToFile', NULL, @FileName, 2
	EXEC sp_OAMethod @ObjectToken, 'Close'
	EXEC sp_OADestroy @ObjectToken  
	SET @sql = 'INSERT INTO dbo.UserBulkData SELECT 0,NULL,'+ @BatchI

Create excel file

Hi, I have create a webpart that's communicate with a oracle database. everything looks fine and works good. Now i want to add a button to create a excel file. I'm using Open XML SDK 2.0 but i get always a access denied when i create the excel. Here is some of my code // Create a spreadsheet document by supplying the filepath. // By default, AutoSave = true, Editable = true, and Type = xlsx.. SpreadsheetDocument spreadsheetDocument = SpreadsheetDocument.Create("excel.xlsx", SpreadsheetDocumentType.Workbook, false); // Add a WorkbookPart to the document. WorkbookPart workbookpart = spreadsheetDocument.AddWorkbookPart(); workbookpart.Workbook = new Workbook(); // Add a WorksheetPart to the WorkbookPart. WorksheetPart worksheetPart = workbookpart.AddNewPart<WorksheetPart>(); worksheetPart.Worksheet = new Worksheet(new SheetData()); // Add Sheets to the Workbook. Sheets sheets = spreadsheetDocument.WorkbookPart.Workbook.AppendChild<Sheets>(new Sheets()); // Append a new worksheet and associate it with the workbook. Sheet sheet = new Sheet() { Id = spreadsheetDocument.WorkbookPart.GetIdOfPart(worksheetPart), SheetId = 1, Name = "mySheet" }; sheets.Append(sheet); workbookpart.Workbook.Save(); // Close the document. spreadsheetDocu

Load the Excel File Dynamically?

Hi All, I want load the excel file in sqlserver destination. The excel file name is current date. How to load the excel file every day? Thanks CMK…

How to Create Excel File Silently with ASP.Net & C#?

Hi there, I am using VS2005, ASP.Net with C#. Here is little situation; and trying to resolve 2 issues. 1.       I need to add dynamic drop down in certain Excel sheet column. 2.        I need to create excel file on the web server silently. Here is the code I am trying to use;        DropDownList dropdownList = new DropDownList();        dropdownList.Items.Add("Item No 1");        dropdownList.Items.Add("Item No 2");        dropdownList.Items.Add("Item No 3");        dropdownList.Items.Add("Item No 4");         //Create an Excel App        Microsoft.Office.Interop.Excel.ApplicationClass excelApp = new                     Microsoft.Office.Interop.Excel.ApplicationClass();        excelApp.Visible = false;         //Interop params        object oMissing = System.Reflection.Missing.Value;       &n

ssis 2008 Loading MULTIPLE EXCEL file

HI it is possible for me to load multiple text file using for each loop,but if i try the same process for EXCEL file then my excel source throws an error. Also when i created my variable in value  i have given the path of my excel file ,still it didnt help me..because the moment i map the variable with the connection string of source excel connnection(property->expression->connection string) it start giving error if you could help me or provide some reference it will be of great help http://bi-polar23.blogspot.com/2007/08/loading-multiple-excel-files-with-ssis.html i tried this link but got stuck with it on step 12 and 14 (below  is my connection string) and variable is @Filename which i have created Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\mushtaq.sheikh\Desktop\ForEach\New Microsoft Excel Worksheet1.xlsx;Extended Properties="Excel 12.0;HDR=YES"; The moment i try to edit my connection string by comparing connection string provided in link it gives error(an OLEBD error has occured with error code 0x80040E73) on excel source Thanks in advance

How to create a SSIS package to import records form SQl Server 2008 tables to text files

I am a newbie to SSIS and would like to create a package to accomplish the task referenced in the above title. Will appreciate any links and pointers in the right direction.   Thanksakoranteng

if ssis package writes to excel file that might be open by a user

I have written a package that writes to an excel file to a network folder. Eventually this package will run as a job. What is the best way to handle the situation where someone opens the file or inadvertantly leaving it open while the package is running and and stop the package.? No one needs to modify or write anything to this file after it is finished

Create zip file of dyanamicaly generated Excel sheet in c#

hi all,   I want to give product details in excel sheet but that excel sheet should be zipped and then pass it to user. I know how to create excel sheet from database but  how to pass that excel sheet into folder and then zip that folder..?   plz giv me any solution 

How to dynamically create HTML file from the code ?

Hi all,Precisely and concisely, I have aspx page that has only one button "Generate". If the user clicked on this button, one HTML page should be created. The created HTML page should have title "Home" and the Body should contain "Hello World". 1) What is the code that should be written inside "Generate" button in order to accomplish this functionality? 2) Assuming the HTML page gets created, How to store it inside specific folder on the local drive? Or how to store it inside DB? I would greatly appreciate any constructive input!

Is it possible to dynamically create Name (file name) when item saved to Doc Library?

Even though users have been instructed on a naming convention for saving documents to a library after creating a new one  from the library template, they forget or don't understand.  I would like to have the Name column (which is taken from the file name that it is saved as)  in the Document Library be a concatenation of other document meta data elements.  Is this possible?  In other words, is it possible for me to dynamically save the document with the correct file name as a Workflow action (in a Designer created workflow)?  I tried it, but without success.

Cannot open .XLSX file in Excel 2010 from WSS 3.0 site



I'm having trouble in opening .xlsx files created using excel 2007. File is on the sharepoint site (WSS 3.0). Since I have installled Office 2010 I am not being able to open this file directly from the browser. However, if I download it on my local PC its seems to open fine.

Excel 2010 shows error "Excel cannot open file "filename" because the file extension or file format is not correct. Verify the file is not corrupted..."

Please can someone suggest what I am missing on my sharepoint site?


How to merge sheets from multiple excel files into one .xls file?


 I have several excel spreadsheet fils, each of them contains multiple work sheets that may storing images or data.

 How could I merge all of these work sheets to just one .xls file and keep their original layout and style using asp.net?

 Thanks in advance.

Stream Writer encoding when creating excel file

I am working on an application in which i save save html files which have ISO-8859-1 encoding (The html files are in spanish).
I use stream writer to save the source of the files as excel files.
The problem is the encoding options available in the system.text.Encoding class are
so when I save the page it changes certain characters.
<big>Can Any 1 suggest which encoding i should use ... </big>
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend