473,382 Members | 1,750 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 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 19273
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Dilantha Seneviratne | last post by:
Hi Could someone advice me on how I could convert an indented text file into a xml file. Any help is greatly appreciated. thanx example indented text file looks like the following ...
4
by: kalio80 | last post by:
Hi everyone I posted an enquiry earlier about using c++ code to convert text files between linux & widows. I ended up with this code: #include <iostream> #include <fstream> using namespace...
2
by: Gustaf Liljegren | last post by:
I'm writing a console program that is supposed to read a bunch of old text files written in CP437 encoding, extract parts of them and output well-formed XML in UTF-8. First problem I run into is to...
3
by: utab | last post by:
Dear all, I have a text file in the form of 1 2 3 4 5 6 --------/--------/--------/--------/--------/--------/ (I just used / to better explain the...
11
by: JimN1 | last post by:
Hi, I am looking for an example to convert a flat text file with variable length records to a flat file with fixed length records. Does anyone have an example?
9
by: olivercfc | last post by:
Hello All, I have a text file in the following format < line 1 line 2 line 3 line < 4 line > 5
3
by: cmdolcet69 | last post by:
How do i parse a text file with data value in it? I have a series of values that are sepereated by commas. the file holds around 3700 values and all these values need to be parsed out and put into...
15
by: javadeveloper | last post by:
Can anybody help me with the code regarding how to convert a text file to JPG file... Its really urgent for me.. I was able to convert a text file to PDF.. But now I need to convert a text file to...
2
by: progvar | last post by:
Hi! can any one help me by providing the method when i open any text file and convert into pdf format. I searched on the net and i got some code but i am not understanding this code and it also...
7
by: chelle2100 | last post by:
hi... i need to write a converter to convert the text file to a binary file with the following file format... CharacterCount:Unsigned Char(This stores the number of characters that is in the file)...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.