C# – Write the data from an Excel sheet to the text file using C#


I need to write the data from an Excel sheet/workbook to the text file using C#.

Also, I want all Excel worksheet data in single text file.

Apart from reading the data from Excel sheets one by one and then appending it to the existing text file, is there any other simple way to do it?

Best Solution

I would suggest using OleDbDataReader with a connection string from www.connectionstrings.com to read the Excel file. You can use your favorite method, say StreamWriter, to spit the data out to a text file.