By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,810 Members | 783 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,810 IT Pros & Developers. It's quick & easy.

How to convert .xls file into text file.

P: n/a
Hello friends,

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

Thxxxxxx,
Sachin.

Dec 15 '06 #1
Share this Question
Share on Google+
8 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
"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

P: n/a
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

P: n/a
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

P: n/a
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.