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

Home » Public Forums » archive » Re: write data to an excell file
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: write data to an excell file [message #42472] Wed, 09 February 2005 12:14 Go to next message
Jonathan Greenberg is currently offline  Jonathan Greenberg
Messages: 91
Registered: November 2002
Member
Is there a reason you are bothering to write directly to XLS file? Just
write a .csv or .txt (Dave Fanning has a nice little program to do this for
you, so you don't need to reinvent the wheel:
http://www.dfanning.com/tip_examples/write_csv_data.pro) A .csv file, in
fact, you can just double click from a PC or Mac and Excel is usually set to
just open it right up.

--j


On 2/9/05 10:29 AM, in article
Pine.OSX.4.61.0502091327350.20752@gouda.local, "Ken Mankoff"
<mankoff@yahoo.com> wrote:

>
>> It looks to me that you are simply creating ASCII files with an
>> .xls extension. This really isn't an excel file. I have looked
>> into the .xls format in the past (it was called "biff" at one
>> point) hoping to create an IDL program that could write native
>> .xls files but I never found a published format.
>
> I think the best place to get this is through OpenOffice.org or
> StarOffice, or the other open source MS-Office-like apps that can
> read/write MS formats.
>
> -k.
> http://spacebit.dyndns.org/
>
Re: write data to an excell file [message #42476 is a reply to message #42472] Wed, 09 February 2005 10:29 Go to previous messageGo to next message
KM is currently offline  KM
Messages: 29
Registered: October 2004
Junior Member
> It looks to me that you are simply creating ASCII files with an
> .xls extension. This really isn't an excel file. I have looked
> into the .xls format in the past (it was called "biff" at one
> point) hoping to create an IDL program that could write native
> .xls files but I never found a published format.

I think the best place to get this is through OpenOffice.org or
StarOffice, or the other open source MS-Office-like apps that can
read/write MS formats.

-k.
http://spacebit.dyndns.org/
Re: write data to an excell file [message #42478 is a reply to message #42476] Wed, 09 February 2005 08:44 Go to previous messageGo to next message
Rick Towler is currently offline  Rick Towler
Messages: 821
Registered: August 1998
Senior Member
Hello Matthias,

It looks to me that you are simply creating ASCII files with an .xls
extension. This really isn't an excel file. I have looked into the
.xls format in the past (it was called "biff" at one point) hoping to
create an IDL program that could write native .xls files but I never
found a published format.

You may find .slk (symbolic link) files are a good alternative. IDL has
a built in function to create .slk files called WRITE_SYLK. In your
case you would simply store all of your data in one array (assuming that
it was of the same data type):

data = [[kk],[xtt],[Tk]]
ok = WRITE_SYLK('C:\test.slk', data)

To add more columns you would add in more data.

WRITE_SYLK will not allow you to write column headers which is an
unfortunate limitation. I have modified WRITE_SYLK so you can pass it a
structure which contains your data and the column headers which is nice
since I always forget which column is which when I look at my data in
excel! If you are interested I can make it available to you.

Cheers!

-Rick


I can't post to the newsgroup (server problems). Please forward this to
the list if you find it useful.





Matthias Demuzere wrote:
> Dear,
>
> I have a problem with writing data to an excell datasheet. My aim is to
> write several columns to 1 same datasheet instead of writing the different
> columns to different datasheets.
>
> This is what i did untill now:
> openw,10,'C:\RSI\IDL56SE\Output-Escompte\MarseilleObservatoi re.xls'
> for hour=0,192 do begin
> printf,10,xtt(hour)
> endfor
> close,10
>
> openw,11,'C:\RSI\IDL56SE\Output-Escompte\MarseilleObservatoi re_T_E.xls'
> for kk=0,192 do begin
> printf,11,Tk(kk)
> endfor
> close,11
>
> Now I woulf like for example print in the first column the time (hour),
> expressed by kk, going from 0 to 192 hours.
> In the second column of the same datasheet, i would like to write xtt (hour)
> and in the third column of the same datasheet, i would like to write
> Tk(hour)
>
> Can anyone help me with that?
>
> Kind Regard,
>
> Matthias Demuzere
Re: write data to an excell file [message #42479 is a reply to message #42478] Wed, 09 February 2005 08:33 Go to previous messageGo to next message
Vince Hradil is currently offline  Vince Hradil
Messages: 574
Registered: December 1999
Senior Member
Try again: (google didn't work right the first time, "I didn't do it!")

tab=string(9b)
openw,10,'C:\RSI\IDL56SE\Output-Escompte\MarseilleObservatoi re.xls'
for hour=0,192 printf,10,hour+tab+xtt[hour]+tab+Tk[hour]
close,10
Re: write data to an excell file [message #42480 is a reply to message #42479] Wed, 09 February 2005 08:27 Go to previous messageGo to next message
Vince Hradil is currently offline  Vince Hradil
Messages: 574
Registered: December 1999
Senior Member
tab=string(9b)
openw,10,'C:\RSI\IDL56SE\Output-Escompte\MarseilleObservatoi re.xls'
for hour=0,192 do printf,10,hour+tab+xtt[hour]+tab+Tk[hour]
close,10
Re: write data to an excell file [message #42543 is a reply to message #42478] Fri, 11 February 2005 03:12 Go to previous message
Ralf Schaa is currently offline  Ralf Schaa
Messages: 37
Registered: June 2001
Member
Hi there,

to write excel sheets I use the good old spawn:

I spawn a perl script which reads all the stuff from a text file which
is previously created by idl.
When you need a lot of excel files it is quite nice to do it this way.

take a look at cpan.org:
Spreadsheet::WriteExcel

Cheers
-Ralf






Rick Towler wrote:
> Hello Matthias,
>
> It looks to me that you are simply creating ASCII files with an .xls
> extension. This really isn't an excel file. I have looked into the
> .xls format in the past (it was called "biff" at one point) hoping to
> create an IDL program that could write native .xls files but I never
> found a published format.
>
> You may find .slk (symbolic link) files are a good alternative. IDL has
> a built in function to create .slk files called WRITE_SYLK. In your
> case you would simply store all of your data in one array (assuming that
> it was of the same data type):
>
> data = [[kk],[xtt],[Tk]]
> ok = WRITE_SYLK('C:\test.slk', data)
>
> To add more columns you would add in more data.
>
> WRITE_SYLK will not allow you to write column headers which is an
> unfortunate limitation. I have modified WRITE_SYLK so you can pass it a
> structure which contains your data and the column headers which is nice
> since I always forget which column is which when I look at my data in
> excel! If you are interested I can make it available to you.
>
> Cheers!
>
> -Rick
>
>
> I can't post to the newsgroup (server problems). Please forward this to
> the list if you find it useful.
>
>
>
>
>
> Matthias Demuzere wrote:
>
>> Dear,
>>
>> I have a problem with writing data to an excell datasheet. My aim is
>> to write several columns to 1 same datasheet instead of writing the
>> different columns to different datasheets.
>>
>> This is what i did untill now:
>> openw,10,'C:\RSI\IDL56SE\Output-Escompte\MarseilleObservatoi re.xls'
>> for hour=0,192 do begin
>> printf,10,xtt(hour)
>> endfor
>> close,10
>>
>> openw,11,'C:\RSI\IDL56SE\Output-Escompte\MarseilleObservatoi re_T_E.xls'
>> for kk=0,192 do begin
>> printf,11,Tk(kk)
>> endfor
>> close,11
>>
>> Now I woulf like for example print in the first column the time
>> (hour), expressed by kk, going from 0 to 192 hours.
>> In the second column of the same datasheet, i would like to write xtt
>> (hour)
>> and in the third column of the same datasheet, i would like to write
>> Tk(hour)
>>
>> Can anyone help me with that?
>>
>> Kind Regard,
>>
>> Matthias Demuzere
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: ENVI Headers
Next Topic: IDL and ENVI run on NTFS compressed drive

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

Current Time: Fri Oct 10 11:35:36 PDT 2025

Total time taken to generate the page: 0.00960 seconds