.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

Posting TXT / excel files

Posted By:      Posted Date: September 28, 2010    Points: 0   Category :Sql Server

Maybe someone can point me in the right direction.

Problem Statement:

Say I have a table that list employees and the departments they work for.  There are 4 departments.

What I want to do is evaluate the table and send to individual texts (prefer xls but for now txt file will do) files employees by department. Additionally I would like it to be dynamic so that if there is a 5<sup>th</sup> department added to the table a new text file with those employees in it would export.  Where the files post is not that important now.  I will say: C:\EmployeesByDepartment\  

Can anyone direct me to a post or words of wisdom that can help me on this matter?

I am using Microsoft Visual Studios 208 that came with my Server 2008 to export this inf

View Complete Post

More Related Resource Links

PrintPocketCE Print Pocket Excel, Pocket Word and email files

Version 3.560 (May 15, 2009):

Important bug fix: a slight difference in how some devices create fonts was causing a few devices to have significantly longer print times for large print jobs.

Adjusted PocketJet printer paper feed commands

Other minor fixes and enhancements.

Version 3.559 (Mar 5, 2009):

Added support for Martel MCP78xx printers

Version 3.558 (Aug 20, 2008):

Added support for Martel MCP78xx printers

Version 3.557 (June 27, 2008):

Fixed error in Canon printer support

Fixed COM0 port selection

Version 3.556 (June 15, 2008):

Added support for Brother MW-260

Added support for Sato MB400

Version 3.555 (Aug 8, 2007):

Added support for Pentax RuggedJet 3 and RuggedJet 4 printers

Changed Epson TM-P60 support to maximum page width of 1200 dots

Version 3.551 (Aug 1, 2006):

Added Peripheral Nomad printer support

Version 3.550 (Mar 23, 2006):

Added Panasonic JT-H200PR printer support

Added Pocket Spectrum printer support

Fixed problem with WM5.0 "inverted image" problem

Reading Excel files from 64-bit ASP.Net app

I have an ASP.Net app that is running on a 64-bit server. Part of that app reads data from Excel files and loads that data into our SQL_Server database.I am using the ACE OLE driver to read the Excel files and it works great on my 32-bit development machine. When we deploy the app (from a 64-bit client machine) to our 64-bit server, I get this exception when trying to open the connection:"System.InvalidOperationException: The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine."There are many posts about addressing this issue, so I think these are my options:1. Compile the app for any cpu from a 32-bit machine and deploy it to the server (making the app 32-bit) - not desirable as ideally we would like to run the app in 64-bit mode2. Convert the excel file to csv then use more base .Net libraries to get the data out3. Install Office on the server and use the Microsoft.Office.Interop.Excel library to access the data - not sure if this will work though4. Purchase a conversion library5.  Wait for the 64-bit version of Office and use the new Microsoft.ACE.OLEDB.14.0 driver. - Can I get a Beta version now?I am looking for confirmation that my options are accurate/complete and guidance on which of these (or another option) are the most viable.Thanks, Mike

import multiple Excel 2007 files using openrowset

hello, I Have a folder that includes multiple excle files (ver 2007), i am trying  to loop through each file using vbscript to import its data to sql 2000 using openrowset but i am getting this error in the openrowset line "[Microsoft][ODBC sql server driver] [sql server] [OLE/DB provider returned message: the microsoft office access DB engine cannot open or write to the file '', it is already open exclusively by another user or you need permission to view or write its data] code 80040E14 source microsoft OLEDB provider for ODBC drivers Any help please    

How to import two excel files into one list?

I know that I can export Excel data into new list in MOSS 2010 via Excel 2010. But when I was trying to add data into existing list, it was impossible. I know one way - copy data in Excel and paste it into the list in DataSheet View. Is there another way?

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

Excel fields linked to files in the document library do not update


We are having an issue with an Excel spreadsheet that is linked to several Excel documents in a document library.  Mutliple staff members update several "sub" spreadsheets with information that is rolled up to the "master" spreadsheet.  Excel appears to behave correctly in that if I open both the sub and master spreadsheets in my Excel window at the same time, the data in master gets updated.  If I just open the master, I have stale data.  I'm not sure SharePoint is to blame here, so I'll post this in the Excel forums as well, but any information or experience anyone has had with this would be fantastic.

Thanks in advance for any help/advice!

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.

Microsoft Office Excel cannot access the file 'C:\inetpub\wwwroot\ProjectWebSite\Files\ROUTINE_MCA.


Hello everybody.

I am in a critical situation. I first tried to make a project (file->new->project) using visual studio, where I displayed the content of a excel file by GridView. I was successful then, but when I attach it to my website located in inetpub I am getting this error :

Microsoft Office Excel cannot access the file 'C:\inetpub\wwwroot\ProjectWebSite\Files\ROUTINE_MCA.xlsx'. There are several possible reasons:

. The file name or path does not exist.
. The file is being used by another program.
. The workbook you are trying to save has the same name as a currently open workbook.

At first I faced some COM related problem and found solution in Google, but this particular problem is not solving. Is there any way to access Excel document in asp.net website?

In my application there is a facility of uploading excel document to the server and then display its content. But I have failed to do this display operation, is there any turn around way, like store the excel document as dataset and then access it as required.

Please help. I am in great trouble. Thanks in advance.

Merging Multiple Excel files (exports from Reporting Services)


So we have Office 2007 on our system and I'm trying to use Excel Interop to take a number of Excel files, which are exports from Reporting Services, and combine them into one large workbook.  I'm using the code below which works fine to get all the information from all the files into one workbook but the colors of things goes absolutely haywire.  Anyone know why my colors are getting all out of wack?

protected void MergeFiles(string destinationFile, string[] sourceFiles, string guid)
                //1. Validate folder,  
                //2. Instantiate excel object  
                //3. Loop through the files  
                //4. Add sheets  
                //5. Save and enjoy!  


Error opening excel files stored in SharePoint 3.0 from VS2010 (TFS2010 setup)



First I hope this is the correct forum for te below question, and if not, please excuse and if possible divert me to the correct place.

We have a TFS2010 setup with (what I managed to identify) Sharepoint Services 3.0.
We have 2 users working in the same collection, and also share some of the projects in it with the below problems:

1. User A has Office 2007. She is unable to "edit workbook" on an excel file directly from VS2010, and gets an error of 'Unknown error trying to lock file'. I searched this around and didn't find a solution, but did find a workaround - If she checks out the file directly from the SharePoint site, she is able to edit the file, and in fact is able to later "edit workbook" directly from VS2010 (as long as she once checked it out through SharePoint).

2. User B has Office 2010. When he tries to "edit workbook", he gets an error of 'A problem occurred while connecting to the server. If the problem continues, contact your administrator'. When he goes directly to the SharePoint, he is able to check out the file, open it in Excel 2010, but is not able to check it back in (gets an error that the file cannot be located or so, I don't have the exact error). This means that this user cannot work with the SharePpoint stored files at all, and currently works on local copies on hi

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


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

Can't open Word & Excel files in MOSS2007



Starting 2 days ago, my users can't open Excel and Word documents that contain spaces in their name (and of course 90% of the documents contains spaces :-( ). Everything else is OK (PDFs, etc).

What is interesting if you rename the files and eliminate the spaces or replaced them with any character (My Files.doc renamed to My_File.doc for example) then everything is fine, we can open and then save them. However I can't ask the users to do that for all documests (zillions :-).

We are using MOSS2007 on a single server Win 2003 R2 Std x64 with a separate SQL 2005 cluster.

I spent 4h otp with Microsoft premier support but no luck.

Anybody experienced the same issue? Any help is greatly appreciated.

Thank you


Error Handling loading Excel Files with SSIS 2005


I have an SSIS job which watches a directory for new files being submitted. On detecting a file(s) it determines the process to perform on it (based on the file name) and then reads in the file, loads it into the database, and deletes the file. All is fine. I want to add error handling though, specifically for the instance where the worksheet name does not correspond to that defined in the Excel Connection manager for this file.

At the moment if I change the sheet name to be different to that defined in the connection manager, the job fails and so (in turn) the whole process ceases (i.e. the for loop also goes to status failed).

I have tried event handler variables and checkpoints but without success. Could someone give me some advise, or point me to a article that would help?


Unable to save Excel files opened from SharePoint

Hi all!

From time to time users have problem saving excel files that they have opened from a SharePoint document library.

Error message:

"Document could not be saved"

It's not possible to save it localy ither.

Any ideas?





    I have some excel files in folder. i want pull the data into respective table ( here file name and data base table name are same), based on fine name pull the data into table.

1)meta data is diff each time and sheet names also different each time.


as per approach is

FOR EACH LOOP  and execute sql task .

'Excel 8.0;Database=C:\test\xltest.xls', 'SELECT * FROM [Customers$]')  this is code in execute sql task.

my problems 1) i selected Fully qualified option in for each loop.

this returns like "C:\Documents and Settings\ADMIN\My Documents\Downloads\bcp\filenames.xls"

i want fetch the filename like" filenames " from above directory .

2) each time sheet names also diff.

how can i identify the sheet name dynamically.

Finnaly my query is 


'Excel 8.0;Databas

SSIS package which reads excel files fails on SQL Server Agent



I have a SSIS package which reads an excel file and loads data into a table using script component(C#) as a source. The package runs without any errors when I manually run it on my machine and on the server. But the package fails when run as a SQL Server Agent job.

I tried all the possible fixes I found on the web but still can't get it to work.

Could you shed some light on it?



Export to Excel big size files (10000 pages) - HTTP Error 401.1



If you attempt to export a file to Excel, the browser hangs for a long time, then begins to request authorization, several times in succession .
Then displays an error message: "you are not authorized to view this page"

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