SV: Convert data files to Excel

Jari.S.Kaljunen@telia.se Jari.S.Kaljunen@telia.se
Tue, 11 Dec 2001 11:26:21 +0100


There is a file format called SYLK  (default suffix .slk) and which is 
possible to open direct with Excel.

A sylk file looks like this:

ID;PWXL;N;E
P;PGeneral
P;P0
P;P#,##0
F;P0;DG0G8;M255
B;Y21;X4;D0 0 20 3
O;L;D;V0;K47;G100 0.001
F;P2;FF2G;C4
C;Y1;X1;K"Name"
C;Y1;X2;K"Title"
C;Y1;X3;K"Salary"
C;Y1;X4;K"Linenumber"
C;Y2;X1;K"Jari"
C;Y2;X2;K"Programmer"
C;Y2;X3;K"Less"
C;Y2;X4;K 1
C;Y3;X1;K"Michael"
C;Y3;X2;K"Boss"
C;Y3;X3;K"More"
C;Y3;X4;K2
E

Note the Y and X coordinates and quotes with charachter strings.

You can experiment with this by creating a Excel file and saving it as 
Sylk file and editing the file. You will see that Excel creates much of 
stuff in the beginning of the file (but only a little of it is really 
needed).

We create first a subfile having the record number ( X coordinate) and 
item number ( Y coordinate) and the item value. Then we run a quiz that 
creates text file that is renamed to *.xls and it opens direct in Excel 
on PC. 


$quiz
acc *sub_item

init head &
tab 1 'ID;PWXL;N;E' &
skip tab 1 &
'P;PGeneral' & 
skip tab 1 &
'P;P0' &
skip tab 1 &
'P;P#,##0' &
skip tab 1 &
'F;P0;DG0G8;M255' &
skip tab 1 &
'B;Y21;X4;D0 0 20 3' &
skip tab 1 &
'O;L;D;V0;K47;G100 0.001' &
skip tab 1 &
'F;P2;FF2G;C4' 

sel if d_elem <> '" "' and d_elem <> ""

set rep nolimit spacing 0 dev disc name sylk nohead page length 0 width 
255

def d_rad char*252 = &
  trunc(pack('C;Y' + ascii(rec_no) + ';X' + ascii(item_no) + ';K' +  
d_elem ))

rep tab 1 d_rad
final foot tab 1 "E"
go


/Jari

-----Ursprungligt meddelande-----
Från:	dmthomas@longfibre.com [SMTP:dmthomas@longfibre.com]
Skickat:	 den 11 december 2001 01:00
Till:	powerh-l@lists.swau.edu
Ämne:	Convert data files to Excel

I'm trying to move a quiz subfile to Excel. I've emailed myself a text
file that I've renamed with the excel file extension which works fine
except when opening it, I have to tweek it a bit to make the columns fit
correctly.  I've delimited this file with a "|" and with a ",". Both do
the same thing.  I would like to be able to have this file open without
having to tweek the file. Any suggestions?


= = = = = = = = = = = = = = = = = = = = = = = = = = = =
Mailing list: powerh-l@lists.swau.edu
Subscribe: "subscribe" in message body to 
powerh-l-request@lists.swau.edu
Unsubscribe: "unsubscribe" in message body to 
powerh-l-request@lists.swau.edu
http://lists.swau.edu/mailman/listinfo/powerh-l
This list is closed, thus to post to the list you must be a subscriber.
 <<Fil: Convert data files to Excel.TXT>>