J
Justin C
I have ten Excel files which I read with Spreadsheet:
arseExcel. Each
file has only one worksheet. The worksheets are 6 columns by
$sheet->MaxRow (ie, I don't know, but perl can find out). Each sheet is
divided into sections of identically structured data, an empty line
divides the sections.
I want to access the data, so it can be output identically, but in a
different format (I can't do straight read/write because I need to do
some calculations on line numbers for page-break purposes before I
output). My intention was to read it all into a hash whose keys would be
the file name, and data would be a hash, whose keys would be a section
number, and data would be a hash.... etc all the way down to cell
contents.
I end up with something like this:
$data{$file}{$section}{$row}{$col}{data} = $cell->{Val}
$data{$file}{$section}{$row}{$col}{format} = $cell->{Format}
I have a hash, $deity knows what's in it! I can't figure out how to
work through it. For example, I need to know how many sections there are
in each file, and how many rows in each section. For the very bottom end
of the processing I need to iterate over the data and format of each
column of each row in each section.
I'm hopelessly lost!
Looking at some docs, I find that what I have (or should have) is:
a hash of file names containing
an array of sections containing
an array of rows containing
an array of columns containing
a hash of value/format data
I've been looking at the chapter 4.7 of Programming Perl, data structure
code examples. There is a "composition of more elaborate records"
section, but I can't translate that to what I have, my brain is just not
getting it.
Maybe I should ask something simple to start with: How do I get the
number of sections that are in, say, file number 2 ($file == 2)?
Actually, I'm not even certain I've got the hash right.
Pointers to reading matter, explanations, suggestions, anything (even a
gun and a bullet) will be gratefully received.
Justin.
file has only one worksheet. The worksheets are 6 columns by
$sheet->MaxRow (ie, I don't know, but perl can find out). Each sheet is
divided into sections of identically structured data, an empty line
divides the sections.
I want to access the data, so it can be output identically, but in a
different format (I can't do straight read/write because I need to do
some calculations on line numbers for page-break purposes before I
output). My intention was to read it all into a hash whose keys would be
the file name, and data would be a hash, whose keys would be a section
number, and data would be a hash.... etc all the way down to cell
contents.
I end up with something like this:
$data{$file}{$section}{$row}{$col}{data} = $cell->{Val}
$data{$file}{$section}{$row}{$col}{format} = $cell->{Format}
I have a hash, $deity knows what's in it! I can't figure out how to
work through it. For example, I need to know how many sections there are
in each file, and how many rows in each section. For the very bottom end
of the processing I need to iterate over the data and format of each
column of each row in each section.
I'm hopelessly lost!
Looking at some docs, I find that what I have (or should have) is:
a hash of file names containing
an array of sections containing
an array of rows containing
an array of columns containing
a hash of value/format data
I've been looking at the chapter 4.7 of Programming Perl, data structure
code examples. There is a "composition of more elaborate records"
section, but I can't translate that to what I have, my brain is just not
getting it.
Maybe I should ask something simple to start with: How do I get the
number of sections that are in, say, file number 2 ($file == 2)?
Actually, I'm not even certain I've got the hash right.
Pointers to reading matter, explanations, suggestions, anything (even a
gun and a bullet) will be gratefully received.
Justin.