I also want to automatically get the total number of rows and write the user input date to all of column D, but I can get to that later. For now I need help understanding why the date is not writing. Any help is very appreciated !use strict; use warnings; use diagnostics; use DBI; use DateTime; use Date::Format; use MIME::Entity; use Spreadsheet::ParseExcel; use Spreadsheet::WriteExcel; my $user_date = $ARGV[0]; my $database = "workflow"; my $host = "database.local"; my $user = "$user"; my $pw = "$pw"; my $dbh = DBI->connect("dbi:mysql:$database:$host", $user, $pw,) or di +e "Database connection FAILED: $DBI::errstr"; my $sth = $dbh->prepare( "SELECT * stuff"); $sth->execute(); my $xWB = Spreadsheet::WriteExcel->new('/path/to/file.xls'); my $xWS = $xWB->add_worksheet('sheet'); $xWS->write(0,0, 'Account'); $xWS->write(0,1, 'PDF Name'); $xWS->write(0,2,'Bill Number'); $xWS->write(0,3, 'Mailed Date'); $xWS->set_column('A:A', 18); $xWS->set_column('B:B', 25); $xWS->set_column('C:C', 12); $xWS->set_column('D:D', 12); while (my $ar = $sth->fetchrow_arrayref) { s{^.*/}{} for @$ar; ++$row, $col = 0; $xWS->write($row,$col++,$_) for @$ar; } #I want the total number of rows and write the user input date through + all rows in this column #$xWS->write("D2:D$row", $user_date); # 212 is the actual number of rows known by viewing the file $xWS->write('D2:D212', $user_date); $xWB->close(); $sth->finish(); $dbh->disconnect;
In reply to User input into Excel by PerlSufi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |