Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: read excel data and write into *.txt file

by mscharrer (Hermit)
on Sep 18, 2008 at 09:56 UTC ( [id://712219]=note: print w/replies, xml ) Need Help??


in reply to Read Excel cell

Reposting old questions wont bring you much on perlmonks, but I try to help you anyway.

First of all you should convert your code using a loop, like below. Then it gets tidy enough to make changes fast and avoid a lot of minor errors which are likely in repetitive code.

Should your output be XML ("output.xml")? Because it isn't yet. Have a look on XML::Simple's function xmlout() for that.

my @CELLS = ( 'pisbn', 'isbn', 'rendition', ...); my %bookdata; # [...] for my $n (0..13) { if($cell = $sheet->{Cells}[$i][$n]) { my $val = $cell->{Val}; #If you would need the data for later: $bookdata{@CELLS[$n]} = $val; #print"\n--", $val; $getfile = $val; } }

PS: Could you use <readmore> tags for code of this length in the future, please.

Update: Are you aware that your code overwrites the output file for every row ($i iteration) and sheet? This could be one of you main problems.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2024-04-25 21:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found