Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: How to modify column in WriteExcel?

by vserzh (Novice)
on Mar 13, 2019 at 10:27 UTC ( [id://1231209] : note . print w/replies, xml ) Need Help??


in reply to Re: How to modify column in WriteExcel?
in thread How to modify column in WriteExcel?

As I understand I get exactly what I need, but.. :)
$VAR1 = [ [ '10000516' ], [ '10000512' ], [ '10000514' ], [ '10000513' ], [ '10000515' ] ];

Replies are listed 'Best First'.
Re^3: How to modify column in WriteExcel?
by poj (Abbot) on Mar 13, 2019 at 10:42 UTC
    #!perl use strict; use Spreadsheet::WriteExcel; my $workbook = Spreadsheet::WriteExcel->new('Report.xls'); my $worksheet = $workbook->add_worksheet("DTicket"); #my $url = $sth->fetchall_arrayref([0]); my $url = [['10000516'],['10000512'], ['10000514'],['10000513'],['10000515']]; my $rowno = 2; for my $row (@$url ){ my $url = 'http://example.com/index.pl?TNumber='.$row->[0]; $worksheet->write_url($rowno++,0, $url, $row->[0]); }
    poj
      It's works thank you very match!

        You don't need to run another query, you can use $data in the loop

        for my $row (@$data ){
        poj
Re^3: How to modify column in WriteExcel?
by hdb (Monsignor) on Mar 13, 2019 at 10:32 UTC

    If this is the output of print Dumper $url; then you need to use $url->[0][0] instead of $url->[0] (the latter being the same as ${$url}[0]).

    Update: or ${${$url}[0]}[0] if you prefer.

      Yes, that output and thank you $url->[0][0] is works, link are valid now. Could you explain me why is two pointers here [0][0]? And another question can I use for/foreach to modify every row in that column?

        fetchall_arrayref returns all rows of your query in an array reference (first level of dereferencing needed) and each row again is an array reference (even when there is only one column) which is the second level of dereferencing. If you want so, you ask for a table, so you get a two-dimensional object...