Load-XMLSS
[1/1] from: Al::Bri::xtra::co::nz at: 10-Jun-2003 21:56
I've attached 'Load-XMLSS, a Rebol function to load a MS Excel spreadsheet
and convert the values to a block of rows, each row being a block of Rebol
values.
Enjoy!
Andrew J Martin
The best software is free!
ICQ: 26227169 http://www.rebol.it/Valley/ http://Valley.150m.com/
-><-
-- Attached file included as plaintext by Listar --
-- File: Load-XMLSS.r
[
Rebol [
Name: 'Load-XMLSS
Title: "Load-XMLSS"
File: %Load-XMLSS.r
Author: "A J Martin"
Owner: "Aztecnology"
Rights: "Copyright © 2003 A J Martin, Aztecnology."
eMail: [Al--Bri--xtra--co--nz]
Web: http://www.valley.it/Valley/
Tabs: 4
Purpose: "Load MS Excel spreadsheet in XMLSS format."
Language: 'English
Date: 10/June/2003
Version: 1.0.3
]
Load-XMLSS: function [
"Load MS Excel spreadsheet in XMLSS format."
File [file!] "The spreadsheet file to load."
] [Row Table] [
all [
parse/all read File [
{<?xml version="1.0"?>}
to "<Worksheet" thru #">" to "<Table" thru #">"
any [to "<Column" thru #">"]
any [
to "<Row" thru #">" (
Row: make block! 12
)
to "<Cell"
any [
"<Cell" to "<Data" thru {Type="} copy Type to {"} thru #">"
copy Item to #"<" thru "</Cell>" (
switch Type [
"String" [
insert tail Row either #"#" = first Item [
to issue! next Item
] [
Item
]
]
"Number" [
insert tail Row attempt [to integer! Item]
]
]
)
to #"<"
]
thru "</Row>" (
if none? Table [
Table: make block! 40
]
insert/only tail Table Row
)
]
thru "</Table>" thru "</Worksheet>" to end
end
]
Table
]
]
]