comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Looking for IDL code to read Excel spreadsheet
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Looking for IDL code to read Excel spreadsheet [message #25681] Wed, 11 July 2001 06:40 Go to next message
Med Bennett is currently offline  Med Bennett
Messages: 109
Registered: April 1997
Senior Member
I use data from Excel all the time, but I always export them to a .CSV (commas
separate values) format first. Then they can be read into IDL easily.
Alternatively, you could study one of the files with a hex editor to figure out
where the data that you want actually starts and how the files are structured, and
then use binary reads. Good luck -

John McFee wrote:

> I have a large number of Excel spreat sheets. They are in a very simple format.
> There is a 1-line four column header, followed by four columns of numbers, eg:
>
> Time Concentration Time2 Response
> 14:48:20 19.29 14:42:01 1.5
> 14:48:25 5.34 14:42:06 0.7
> ...etc.
>
> I want to read in the numbers for processing in IDL. I could, within Excel,
> export the data to an ascii file, but there are a LOT of files to do. Is there
> an IDL routine that will read a simple Excel spreadsheet like this? (To make
> matters worse, I run IDL on a Sun Sparcstation.)
>
> I apologize if this has been covered in the newsgroup and I've missed it, but I
> have looked in various FAQs and through the various IDL libraries and archives
> on the Web and have found nothing so far.
>
> Thanks
>
> John McFee
>
> --
> Dr. John E. McFee
> Defence Research Establishment Suffield
> Box 4000, Medicine Hat, AB Canada T1A 8K6
> (403) 544-4739 (voice) 544-4704 (fax)
> e-mail: John.McFee@dres.dnd.ca
> --
> ____________
> Dr. John E. McFee | John.McFee@dres.dnd.ca
> Head Threat Detection Group | www.dres.dnd.ca, www.ccmat.gc.ca
> Defence Research Establishment Suffield | PH: 403-544-4739
Re: Looking for IDL code to read Excel spreadsheet [message #25689 is a reply to message #25681] Tue, 10 July 2001 14:39 Go to previous messageGo to next message
Rick Towler is currently offline  Rick Towler
Messages: 821
Registered: August 1998
Senior Member
Unless someone comes up with some code to read .xls files I think your best
bet would be writing a VBA script within excel to export all of your files
to ASCII. Visual Basic for Applications ships with all Office products back
at least to Office 95 and is an excellent tool for this sort of problem. A
few tips: the help files are not installed by default. Get that office CD
out and install them. If your VB skills are weak, use the macro recorder to
learn how to do things. When you record a macro, VB code is generated. Go
back and examine the code for insight info VBA for excel.

The way I see this working is that you have an excel worksheet where the
first column holds the list of files you need to process. Write your VB
macro so that it loops thru these files, opening the .xls file, exporting it
as an ASCII file, then closing it. It should be fairly straight forward.

Good luck!

-Rick Towler


"John McFee" <jmcfee@dres.dnd.ca> wrote in message
news:994780527.158211@coyote...
>
> I have a large number of Excel spreat sheets. They are in a very simple
format.
> There is a 1-line four column header, followed by four columns of numbers,
eg:
>
> Time Concentration Time2 Response
> 14:48:20 19.29 14:42:01 1.5
> 14:48:25 5.34 14:42:06 0.7
> ...etc.
>
> I want to read in the numbers for processing in IDL. I could, within
Excel,
> export the data to an ascii file, but there are a LOT of files to do. Is
there
> an IDL routine that will read a simple Excel spreadsheet like this? (To
make
> matters worse, I run IDL on a Sun Sparcstation.)
>
> I apologize if this has been covered in the newsgroup and I've missed it,
but I
> have looked in various FAQs and through the various IDL libraries and
archives
> on the Web and have found nothing so far.
>
> Thanks
>
> John McFee
>
> --
> Dr. John E. McFee
> Defence Research Establishment Suffield
> Box 4000, Medicine Hat, AB Canada T1A 8K6
> (403) 544-4739 (voice) 544-4704 (fax)
> e-mail: John.McFee@dres.dnd.ca
> --
> ____________
> Dr. John E. McFee | John.McFee@dres.dnd.ca
> Head Threat Detection Group | www.dres.dnd.ca,
www.ccmat.gc.ca
> Defence Research Establishment Suffield | PH: 403-544-4739
Re: Looking for IDL code to read Excel spreadsheet [message #25733 is a reply to message #25681] Thu, 12 July 2001 11:03 Go to previous messageGo to next message
jmcfee is currently offline  jmcfee
Messages: 17
Registered: August 1995
Junior Member
<9ij05q$2j68$1@agate.berkeley.edu>
Organization: Defence Research Establishment Suffield
Keywords:

Thanks to everyone for their help. I'll export as .csv files. The less fooling
around with MicroSoft, the better!

John McFee

In article <9ij05q$2j68$1@agate.berkeley.edu>,
mperrin+news@arkham.berkeley.edu (Marshall Perrin) writes:
...
|> > I use data from Excel all the time, but I always export them to a .CSV
...
|> > Alternatively, you could study one of the files with a hex editor to figure
out
|> > where the data that you want actually starts and how the files are
structured, and
|> > then use binary reads. Good luck -
|>
|> Don't even think about trying to do it in binary - .xls files, like .doc and
|> the rest of the MS Office file formats, are in an extremely complicated
format
|> called DocFile, which basically is an entire file-system-in-a-file, complete
|> with FAT tables, directory structures, and balanced red-black trees wrapped
|> around all the actual spreadsheet data. You *don't* want to have to write a
|> parser for that mess in IDL. Stick with the CSV export - fast and easy.
|>
|> - Marshall

--
Dr. John E. McFee
Defence Research Establishment Suffield
Box 4000, Medicine Hat, AB Canada T1A 8K6
(403) 544-4739 (voice) 544-4704 (fax)
e-mail: John.McFee@dres.dnd.ca
--
____________
Dr. John E. McFee | John.McFee@dres.dnd.ca
Head Threat Detection Group | www.dres.dnd.ca, www.ccmat.gc.ca
Defence Research Establishment Suffield | PH: 403-544-4739
Re: Looking for IDL code to read Excel spreadsheet [message #25757 is a reply to message #25681] Wed, 11 July 2001 18:57 Go to previous messageGo to next message
mperrin+news is currently offline  mperrin+news
Messages: 81
Registered: May 2001
Member
Med Bennett <mbennett@indra.com> wrote:
> I use data from Excel all the time, but I always export them to a .CSV (commas
> separate values) format first. Then they can be read into IDL easily.
> Alternatively, you could study one of the files with a hex editor to figure out
> where the data that you want actually starts and how the files are structured, and
> then use binary reads. Good luck -

Don't even think about trying to do it in binary - .xls files, like .doc and
the rest of the MS Office file formats, are in an extremely complicated format
called DocFile, which basically is an entire file-system-in-a-file, complete
with FAT tables, directory structures, and balanced red-black trees wrapped
around all the actual spreadsheet data. You *don't* want to have to write a
parser for that mess in IDL. Stick with the CSV export - fast and easy.

- Marshall
Re: Looking for IDL code to read Excel spreadsheet [message #25822 is a reply to message #25733] Fri, 13 July 2001 10:58 Go to previous message
gogosgogos is currently offline  gogosgogos
Messages: 15
Registered: July 2001
Junior Member
what about running an odbc query on dataminer and quering excel?
should be fairly easy from the pc, but from the sun,
u might need some cross-platform odbc drivers, brrrrr....

i would just stick to a batch generation of csv data, quick and dirty,
but so what ???

cheers!
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: a vector of indices of the largest elements in a vector not exceeding the elements of some other vector
Next Topic: 3-D plotting

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:39:04 PDT 2025

Total time taken to generate the page: 0.00752 seconds