Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

(jeffa) Re: Spreadsheet::ParseExcel::Simple

by jeffa (Bishop)
on May 24, 2003 at 15:14 UTC ( [id://260591]=note: print w/replies, xml ) Need Help??


in reply to Spreadsheet::ParseExcel::Simple

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)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://260591]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2024-12-07 14:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which IDE have you been most impressed by?













    Results (50 votes). Check out past polls.