mustafa

mustafa

  • NA
  • 1
  • 0

Implementing MS-Excel (Text to columns) function using c# ?

May 26 2009 3:00 AM
Hi all,

I'm working in a project in which I need to import a text file containing a stream of comma delimited lines of data and convert it into a Microsoft Excel 2007 file in order to perform some queries on the Excel file and give some results.

When I wrote a code doing this, it took a very long execution time because the text file contains about 70,000 lines and I had to loop over all these lines, read each line, get the data in between the commas, then write it into the Excel file.

Then I knew that there is a built-in Microsoft Excel function called (Text to columns) in the (Data) menu which is doing the same job in a few seconds only.

The Question is : is there any way to import this Excel (Text to columns) function or use it into my C# code so that the user of my program doesn't have to open the text file in Microsoft Excel and convert the data into columns before using my program ?

Thanks.