Read .xls (Excel) files 
Author Message
 Read .xls (Excel) files

Hello out there,
I was asked whether I could read and interprete Excel (.xls) files. Is
there a way using C and / or Tcl?

Thanks
Helmut



Tue, 11 May 2004 20:40:07 GMT  
 Read .xls (Excel) files
Hi Helmut,

the best way is to use tcom to open XLS files and to read or modify their
contents!

For more information and URLs to tcom use: http://mini.net/tcl/COM

Bye

Martin Lemburg



Quote:
> Hello out there,
> I was asked whether I could read and interprete Excel (.xls) files. Is
> there a way using C and / or Tcl?

> Thanks
> Helmut



Tue, 11 May 2004 21:43:15 GMT  
 Read .xls (Excel) files
On Fri, 23 Nov 2001 14:43:15 +0100, "Martin Lemburg"

Quote:

>Hi Helmut,

>the best way is to use tcom to open XLS files and to read or modify their
>contents!

>For more information and URLs to tcom use: http://mini.net/tcl/COM

>Bye

>Martin Lemburg

Thanks Martin,
if I understand this correctly I will use tcom to
- fire up Excel
- have it load the .xls file(s) in question
- and then
-- export them as .csv files or
-- get at the data "directly" via COM
 to have access to the data.

Is this what you suggested?

Thanks
Helmut



Tue, 11 May 2004 22:35:01 GMT  
 Read .xls (Excel) files
Hi,
I did similar thing, it works very well. You have a total control on the
excel application :
you can read, write and manipulate each cell.
Look at the example distributed with the Tcom package

Stphane,

Helmut Giese a crit :

Quote:

> On Fri, 23 Nov 2001 14:43:15 +0100, "Martin Lemburg"

> >Hi Helmut,

> >the best way is to use tcom to open XLS files and to read or modify their
> >contents!

> >For more information and URLs to tcom use: http://mini.net/tcl/COM

> >Bye

> >Martin Lemburg

> Thanks Martin,
> if I understand this correctly I will use tcom to
> - fire up Excel
> - have it load the .xls file(s) in question
> - and then
> -- export them as .csv files or
> -- get at the data "directly" via COM
>  to have access to the data.

> Is this what you suggested?

> Thanks
> Helmut



Wed, 12 May 2004 10:15:07 GMT  
 Read .xls (Excel) files


Quote:
>Hello out there,
>I was asked whether I could read and interprete Excel (.xls) files. Is
>there a way using C and / or Tcl?

Hm, maybe I should have put things more clearly:
- I am *only* interested in the data. I need to extract them from .xls
files and put them into plain ASCII files.
- I am not primarily interested in controlling Excel. Of course I'll
go this way if there is no other, but I would largely prefer a
different approach, since Excel is so sloooow. (It is a matter of
handling repeatedly several hundred files each > 1MB.)

Are there other ways to get at the data, or do I have to pass by
Excel?

I would be grateful for any further hints.
Helmut



Wed, 12 May 2004 06:01:36 GMT  
 Read .xls (Excel) files
Another way is to use the excel file as an ODBC database (it will be
faster as COM, excel is not run.)
After, you will use tclodbc to read the database.

But be carefull!!!!!!!!!!!!
You have a limitation to 255 columns coming from the Microsoft driver.
If, in the same column, you have a mix of dates, numbers and/or chars,
you will miss data.

Stphane,

Helmut Giese a crit :

Quote:



> >Hello out there,
> >I was asked whether I could read and interprete Excel (.xls) files. Is
> >there a way using C and / or Tcl?

> Hm, maybe I should have put things more clearly:
> - I am *only* interested in the data. I need to extract them from .xls
> files and put them into plain ASCII files.
> - I am not primarily interested in controlling Excel. Of course I'll
> go this way if there is no other, but I would largely prefer a
> different approach, since Excel is so sloooow. (It is a matter of
> handling repeatedly several hundred files each > 1MB.)

> Are there other ways to get at the data, or do I have to pass by
> Excel?

> I would be grateful for any further hints.
> Helmut



Wed, 12 May 2004 14:49:00 GMT  
 Read .xls (Excel) files

Quote:



>>Hello out there,
>>I was asked whether I could read and interprete Excel (.xls) files. Is
>>there a way using C and / or Tcl?

>Hm, maybe I should have put things more clearly:
>- I am *only* interested in the data. I need to extract them from .xls
>files and put them into plain ASCII files.
>- I am not primarily interested in controlling Excel. Of course I'll
>go this way if there is no other, but I would largely prefer a
>different approach, since Excel is so sloooow. (It is a matter of
>handling repeatedly several hundred files each > 1MB.)

>Are there other ways to get at the data, or do I have to pass by
>Excel?

                        .
                        .
                        .
Not with Tcl directly.  I understand what you're
after; to the best of my knowledge, no one has
done this with Tcl.

Perl folks have it, though, rather conveniently:
<URL: http://www.cpan.org/modules/by-module/Spreadsheet/
Spreadsheet-ParseExcel-0.2403.readme >.  There are
several ways to manage Perl from within Tcl, if
that's a help.
--


Business:  http://www.Phaseit.net
Personal:  http://starbase.neosoft.com/~claird/home.html



Wed, 12 May 2004 10:25:48 GMT  
 Read .xls (Excel) files


Quote:
>Hello out there,
>I was asked whether I could read and interprete Excel (.xls) files. Is
>there a way using C and / or Tcl?

Thanks to all of you for your suggestions, things are a lot clearer
now.
For a start, I will use tcom and Excel to arrive fast at a working
solution. Then, if the client is content with the speed, all is over.
If not, I can offer a speed improvement by either
- following Cameron's hint on using Perl (this, however, should work
right out of the box, since I don't speak Perl and - knowing Tcl -
don't have any inclination to learn it) or
- use the information at http://www.wotsit.org/ (search for XLS), that
describes the internal structure of .xls files to build a Tcl only
solution. (With this client, this might even result in an open source
solution).

Have a nice weekend (or what's left of it)
Helmut



Thu, 13 May 2004 07:34:34 GMT  
 Read .xls (Excel) files
On Sat, 24 Nov 2001 01:49:00 -0500, Stephane Padovani

Quote:

>Another way is to use the excel file as an ODBC database (it will be
>faster as COM, excel is not run.)
>After, you will use tclodbc to read the database.

Thank you for this suggestion.

Quote:

>But be carefull!!!!!!!!!!!!
>You have a limitation to 255 columns coming from the Microsoft driver.
>If, in the same column, you have a mix of dates, numbers and/or chars,
>you will miss data.

This is  a very valuable warning. The data from the source will not
always be complete or without errors / omissions. Therefor I think
I'll go another way.

Best regards
Helmut



Thu, 13 May 2004 07:40:14 GMT  
 Read .xls (Excel) files


 (Helmut Giese)

 :>Hello out there,
 :>I was asked whether I could read and interprete Excel (.xls) files. Is
 :>there a way using C and / or Tcl?

 : Hm, maybe I should have put things more clearly:
 : - I am *only* interested in the data. I need to extract them from .xls
 : files and put them into plain ASCII files.

 I've once written a tool named xls2csv (see
 http://www.ice.ru/~vitus/catdoc) which does exactly this.

Main advantage of it is that you don't need to buy Microsoft Windows
not to mention Excel to use it.

Unfortunately, it still have some problems (and I have no motivation to
fix them) - OLE parsing is not robust enough, some cell types (probably,
appeared in newer versions of Excel) are not recognized.

There is also Spreadsheet::ParseExcel perl module on CPAN. You might get
it and port to Tcl. Given Tcl's power of handling encodings it would be
easy to parse Unicode Excel files.

--
If you're going to define a shortcut, then make it the base [sic] darn
shortcut you can.



Wed, 12 May 2004 15:57:33 GMT  
 Read .xls (Excel) files

Quote:

> I've once written a tool named xls2csv (see
> http://www.ice.ru/~vitus/catdoc) which does exactly this.

>Main advantage of it is that you don't need to buy Microsoft Windows
>not to mention Excel to use it.

>Unfortunately, it still have some problems (and I have no motivation to
>fix them) - OLE parsing is not robust enough, some cell types (probably,
>appeared in newer versions of Excel) are not recognized.

>There is also Spreadsheet::ParseExcel perl module on CPAN. You might get
>it and port to Tcl. Given Tcl's power of handling encodings it would be
>easy to parse Unicode Excel files.

Thanks Victor,
this sure looks interesting.
Helmut


Thu, 13 May 2004 21:56:54 GMT  
 
 [ 11 post ] 

 Relevant Pages 

1. Fortran/C reading Excel (.xls) files

2. Read Excel (xls) files

3. Excel xls file format

4. Excel users: here's a proc to convert XLS files to CSV format (correction)

5. Excel users: here's a proc to convert XLS files to CSV format

6. Xls excel export

7. Read/Write to MS-Excel file?

8. Reading from Excel files

9. How to read Excel File direct from Clipper 5.2

10. Read Excel Spreadsheet into a .TPS File

11. Read all cells from an Excel file?

12. Reading & searching from a EXCEL file

 

 
Powered by phpBB® Forum Software