PC Review


Reply
Thread Tools Rate Thread

How to convert .xls file into text file.

 
 
pappu
Guest
Posts: n/a
 
      15th Dec 2006
Hello friends,

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

Thxxxxxx,
Sachin.

 
Reply With Quote
 
 
 
 
Morten Wennevik
Guest
Posts: n/a
 
      15th Dec 2006
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:\\MyWorkbook.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 <(E-Mail Removed)>
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]
 
Reply With Quote
 
Laurent Bugnion
Guest
Posts: n/a
 
      15th Dec 2006
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:\\MyWorkbook.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
 
Reply With Quote
 
Sonya
Guest
Posts: n/a
 
      15th Dec 2006
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.
 
Reply With Quote
 
Laurent Bugnion
Guest
Posts: n/a
 
      15th Dec 2006
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
 
Reply With Quote
 
Mark Rae
Guest
Posts: n/a
 
      15th Dec 2006
"Laurent Bugnion" <galasoft-(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...

> 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


 
Reply With Quote
 
Ignacio Machin \( .NET/ C# MVP \)
Guest
Posts: n/a
 
      15th Dec 2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello friends,
>
> I want to convert .xls file into text file.So can anybody pls
> help me out.
>
> Thxxxxxx,
> Sachin.
>



 
Reply With Quote
 
Ignacio Machin \( .NET/ C# MVP \)
Guest
Posts: n/a
 
      15th Dec 2006
Hi
"Morten Wennevik" <(E-Mail Removed)> wrote in message
news(E-Mail Removed)...
> 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


 
Reply With Quote
 
Ignacio Machin \( .NET/ C# MVP \)
Guest
Posts: n/a
 
      15th Dec 2006
hi

what if he neeeds to do this in a service? or do this everyday at midnight?


--
Ignacio Machin
machin AT laceupsolutions com


"Sonya" <(E-Mail Removed)> wrote in message
news:OfL%23V$(E-Mail Removed)...
> 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.



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I convert excel file into ASCII text file with alignment? =?Utf-8?B?Um9zYWlhaA==?= Microsoft Excel Misc 2 27th Jun 2005 12:17 PM
How do I convert Rich Text File to Excel or Access File? =?Utf-8?B?a29ybWFu?= Microsoft Word Document Management 2 15th Jun 2005 08:09 AM
Convert excel file to flat text file =?Utf-8?B?TGFubnV0c2xw?= Microsoft Excel Misc 1 1st Jun 2005 03:48 AM
RE: Convert excel file to flat text file =?Utf-8?B?R2FyeSdzIFN0dWRlbnQ=?= Microsoft Excel Misc 0 1st Jun 2005 12:17 AM
How do I convert Organizer 6.0 file to text file for import to Outlook mgibson99 Microsoft Outlook 0 21st Jan 2004 05:48 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:25 AM.