You need to be concentrating on
Learning Perl, as this code will not
teach you all the parts you need to understand the whole.
But here goes. All i did was grab the Synopsis code from
the documention for
Spreadsheet::ParseExcel::Simple
and added a line to open the output file and line to
print each row of data from the spreadsheet
(seperated by a single space) to that output file. Since
you didn't specify the column numbers for vin, model, and
year ... well ... i'll just make them up! This code is
untested:
use strict;
use warnings;
my $xls = Spreadsheet::ParseExcel::Simple->read('/tmp/carlist.xls');
open OUT, '>', 'carlist.txt' or die $!;
# these are made up: vin = 2, model = 4, year = 7
# put the right column numbers in here
my @cols = (2,4,7);
foreach my $sheet ($xls->sheets) {
while ($sheet->has_data) {
my @data = $sheet->next_row;
print OUT, "@data[@cols]\n";
}
}
jeffa
L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)
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.