I have a spreadsheet I wish to parse via Spreadsheet::ParseExcel. For the most part my parsing script works very well but I want to capture some additional information and need help with the best approach.
The spreadsheet is the output of my company's order entry application. Each device we sell grouped by a Device description cell followed by 5 to 15 lines of part numbers. The key word identifying a new device is "SYSTEM" which occurs in a specific column (2). I can locate that cell with a if statement and that works. What I want to do is iterate through the spreadsheet rows (currently a foreach statement) until I find the SYSTEM cell, then capture the part number rows. I can do that much already. However, I want to continue to capture the part number rows UNTIL I reach the next SYSTEM header and then start the process over. My goal is to capture the SYSTEM header or description and add it to the part number rows as I insert it into a mysql database. Here is how things look at a high level:
Device description cell
SYSTEM
Part 1
Part 2
Part 3
Part 4
Device description cell
SYSTEM
Part 1
Part 2
Part 3
Part 4
Device description cell
SYSTEM
Part 1
Part 2
Part 3
Part 4
I would think I would call a subroutine which calls itself agian each time it encounters the SYSTEM key word. But I am not sure what kind of iterative loop would work best in this case. I am hoping the kind and wise Perl Monks can recommend the statement structure that would work best to address my objective.
Thank you!
Hagen
Boulder, CO
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.