senthil_v has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's minimum standard of quality and will not be displayed.

Replies are listed 'Best First'.
Re: Read Excel cell
by GrandFather (Saint) on Sep 18, 2008 at 06:03 UTC

    Coming up for your monk day is not new! This is your second post and again you have failed to format your node and have ignored the mess in the preview. Are you going to ignore any questions in replies as you did last time?

    Do you really intend the assignment $cell = $sheet->... in the first and following if expressions?


    Perl reduces RSI - it saves typing
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: read excel data and write into *.txt file
by mscharrer (Hermit) on Sep 18, 2008 at 09:56 UTC
    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.

Re: Read Excel cell
by mscharrer (Hermit) on Sep 18, 2008 at 14:25 UTC
    Because your other post got reaped: My answer to it is also valid for this post.