472,142 Members | 1,298 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,142 software developers and data experts.

How to convert .xls file into text file.

Hello friends,

I want to convert .xls file into text file.So can anybody pls
help me out.

Thxxxxxx,
Sachin.

Dec 15 '06 #1
8 19071
Hi Sachin,

You can convert excel files to comma separated files in several ways. You
can do it directly from Excel in save as, using the office API (requires
Excel installed)

ThisApplication.ActiveWorkbook.SaveAs("c:\\MyWorkb ook.xml",
Excel.XlFileFormat.xlCSVMSDOS, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Excel.XlSaveAsAccessMode.xlNoChange,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);

Or using an OleDB provider and write your custom method for reading excel
files and outputting as text files.
On Fri, 15 Dec 2006 06:35:57 +0100, pappu <gu*************@gmail.com>
wrote:
Hello friends,

I want to convert .xls file into text file.So can anybody pls
help me out.

Thxxxxxx,
Sachin.


--
Happy Coding!
Morten Wennevik [C# MVP]
Dec 15 '06 #2
Hi,

Morten Wennevik wrote:
Hi Sachin,

You can convert excel files to comma separated files in several ways.
You can do it directly from Excel in save as, using the office API
(requires Excel installed)

ThisApplication.ActiveWorkbook.SaveAs("c:\\MyWorkb ook.xml",
Excel.XlFileFormat.xlCSVMSDOS, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Excel.XlSaveAsAccessMode.xlNoChange,
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing);
We miss the context, but it's always good to mention that Microsoft
explicitly recommends against server-side automation of Office.
http://support.microsoft.com/kb/257757
Or using an OleDB provider and write your custom method for reading
excel files and outputting as text files.
I like that option much better.
http://geekswithblogs.net/lbugnion/a.../25/89315.aspx

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Dec 15 '06 #3
To speak from one's own experience there is often no necessity to read
the xls-file. If you only want to get data of one table inside the
xls-file just export it to csv-file.
Dec 15 '06 #4
Hi,

Sonya wrote:
To speak from one's own experience there is often no necessity to read
the xls-file. If you only want to get data of one table inside the
xls-file just export it to csv-file.
Isn't it like saying "To speak from experience, one often doesn't need a
car, one can walk". I think it really depends on the situation. I see
one case at least where using an Excel file instead of a CSV file makes
sense: Mobile environments (in my case, Palm PDAs) support editing
native Excel files, but do not support exporting to CSV. In that case,
reading an Excel file from a NET application is needed. Additionally,
Excel can only export one sheet to a CSV file, not all sheets. For
multiple sheets, additional work is needed to merge multiple CSV files
to one before reading them.

Based on my own experience, it's not possible to generalize :-)

Greetings,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Dec 15 '06 #5
"Laurent Bugnion" <ga*********@bluewin.chwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
We miss the context, but it's always good to mention that Microsoft
explicitly recommends against server-side automation of Office.
http://support.microsoft.com/kb/257757
That's true, but the OP doesn't specifically mention server-side - he
certainly doesn't mention ASP.NET... WinForms automation is perfectly OK...
>Or using an OleDB provider and write your custom method for reading excel
files and outputting as text files.

I like that option much better.
http://geekswithblogs.net/lbugnion/a.../25/89315.aspx
Or even this, if more functionality is required:
http://www.aspose.com/Products/Aspos...s/Default.aspx
Dec 15 '06 #6
Hi,

Extremely easy to do, read the excel file using OleDB (google the code for
this)
and just export it like csv.

Send me an email if you are too lazy to find the code
--
Ignacio Machin
machin AT laceupsolutions com

"pappu" <gu*************@gmail.comwrote in message
news:11**********************@l12g2000cwl.googlegr oups.com...
Hello friends,

I want to convert .xls file into text file.So can anybody pls
help me out.

Thxxxxxx,
Sachin.

Dec 15 '06 #7
Hi
"Morten Wennevik" <Mo************@hotmail.comwrote in message
news:op***************@tr024.bouvet.no...
Hi Sachin,

You can convert excel files to comma separated files in several ways. You
can do it directly from Excel in save as, using the office API (requires
Excel installed)
I think that this is like shooting a fish with a cannon, using OleDB you can
read the file as a datasource and simply write down a csv file with just a
few lines of codes
--
Ignacio Machin
machin AT laceupsolutions com
Dec 15 '06 #8
hi

what if he neeeds to do this in a service? or do this everyday at midnight?
--
Ignacio Machin
machin AT laceupsolutions com
"Sonya" <so***@nowhere.comwrote in message
news:Of***************@TK2MSFTNGP02.phx.gbl...
To speak from one's own experience there is often no necessity to read the
xls-file. If you only want to get data of one table inside the xls-file
just export it to csv-file.

Dec 15 '06 #9

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Dilantha Seneviratne | last post: by
4 posts views Thread by kalio80 | last post: by
2 posts views Thread by Gustaf Liljegren | last post: by
3 posts views Thread by utab | last post: by
9 posts views Thread by olivercfc | last post: by
3 posts views Thread by cmdolcet69 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.