40 users online (0 members and 40 guests)  


  Results 1 to 4 of 4

Related

  1. xml file reading    Forum: Javascript Forum
    Replies: 0
  2. Reading file from different HD    Forum: CGI Perl Forum
    Replies: 0
  3. Problem with excel file writing using PERL    Forum: CGI Perl Forum
    Replies: 0
  4. problem in file reading    Forum: CGI Perl Forum
    Replies: 1
  5. Insert image into Excel using perl?    Forum: CGI Perl Forum
    Replies: 1
  1. #1
    vamshi's Avatar
    New User

    Status
    Offline
    Join Date
    Nov 2007
    Posts
    13

    problem with excel file reading in Perl-Cgi

    Hi i got problem while saving the content to excel file and reading that file( using perl-cgi script).
    the file is not saving to the folder called tmp while trying to save with some data.
    but when i see from the putty with tail -f coommand the file is created and deleted immediately in the tmp folder...
    please need a help.

  2. #2
    xmassey's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Apr 2007
    Posts
    100

    Re: problem with excel file reading in Perl-Cgi

    Hi,
    Can you post your script please. From your description it is likely that you have performed the file save action, then later performed an unlink action, or something similar.
    Chris

  3. #3
    vamshi's Avatar
    New User

    Status
    Offline
    Join Date
    Nov 2007
    Posts
    13

    Re: problem with excel file reading in Perl-Cgi

    Hi,
    yes i am doing the same what u r thinking.
    following is the code( see the last line where i am saving the file)....and Saveparser is another module file.
    my($iFmt, $debug);
    my $assetpi_xls = 'Report/asset_report_pi.xls';
    $debug = 0;

    my $oExcel = new Spreadsheet::ParseExcel::SaveParser;
    my $oBook = $oExcel->Parse($assetpi_xls) || die("Parse error: $assetpi_xls");
    if(!($oBook)) {
    $oBook = Spreadsheet::ParseExcel::Workbook->Parse("$assetpi_xls");
    }
    if(!($oBook)) {
    die ("Error: $assetpi_xls read error");
    }
    my $time = time;
    my $date = localtime($time);
    my $oWkS = $oBook->{Worksheet}[0];
    my $name = $oWkS->{Name};
    my $q;
    my $skip = 4;
    my($row, $col);
    my $query = qq{query here};
    my($rows, $count) = $dbc->fetchAll($query);
    for my $i (0 .. $#$rows) {
    $row = $skip + $i;
    $col = -1;
    $iFmt = $oBook->{Worksheet}[0]->{Cells}[$row][0];
    $oBook->AddCell(0, $row, 0, $row, $iFmt);
    foreach my $val (@{ $rows }[$i]) {
    $col++;
    $iFmt = $oBook->{Worksheet}[0]->{Cells}[$row][$col];
    $oBook->AddCell(0, $row, $col, $val, $iFmt);
    }
    }
    $iFmt = $oBook->{Worksheet}[0]->{Cells}[1][7];
    $oBook->AddCell(0, 1, 1, $date, $iFmt);
    $iFmt = $oBook->{Worksheet}[0]->{Cells}[1][1];
    $oExcel->SaveAs($oBook, qq{/tmp/temp.xls.$time});

  4. #4
    vamshi's Avatar
    New User

    Status
    Offline
    Join Date
    Nov 2007
    Posts
    13

    Re: problem with excel file reading in Perl-Cgi

    Hi ,
    The problem is with data reading i think.
    bacoz in the code actually puulling the records from databse and depend on the fetching rows writing the records to the excel sheet.
    but here if i put manually 10 for looping it is perfectly working where as with the query it is getting 39000 loops so this the problem i think.
    how i can solve this large amount of data problem
    please suggest



Tags for this Thread