OpenOffice Spreadsheet

Discussion in 'Perl Misc' started by Grehom, Nov 17, 2008.

  1. Grehom

    Grehom Guest

    I'm just trying to read a column in a spreadsheet and create a new
    value in a new column to right of the others.
    I tried with the following, but it doesn't create the new column, any
    hints please

    use OpenOffice::OODoc;
    my $doc = odfDocument(file => 'iwm.ods');

    $row = 3;
    while ( my $cli = $doc->cellValue(0, "D$row") ) {
    my $username = get_customer_account( $dbh, $cli );
    print "$cli => $username\n";
    $doc->cellValue(0, "E$row", $username);
    $row++;
    }

    $doc->save();


    It's reading the spreadsheet fine, but it's not inserting the new
    value into 'E' column
    Grehom, Nov 17, 2008
    #1
    1. Advertising

  2. Grehom schrieb:
    > I'm just trying to read a column in a spreadsheet and create a new
    > value in a new column to right of the others.
    > I tried with the following, but it doesn't create the new column, any
    > hints please
    >
    > use OpenOffice::OODoc;
    > my $doc = odfDocument(file => 'iwm.ods');
    >
    > $row = 3;
    > while ( my $cli = $doc->cellValue(0, "D$row") ) {
    > my $username = get_customer_account( $dbh, $cli );
    > print "$cli => $username\n";
    > $doc->cellValue(0, "E$row", $username);
    > $row++;
    > }
    >
    > $doc->save();
    >
    >
    > It's reading the spreadsheet fine, but it's not inserting the new
    > value into 'E' column


    Try
    $doc->updateCell(0, "E$row", $username);
    Chris Haffenstedt, Nov 18, 2008
    #2
    1. Advertising

  3. Grehom

    Grehom Guest

    On Nov 18, 11:41 am, Chris Haffenstedt <> wrote:
    > Grehomschrieb:
    >
    >
    >
    > > I'm just trying to read a column in a spreadsheet and create a new
    > > value in a new column to right of the others.
    > > I tried with the following, but it doesn't create the new column, any
    > > hints please

    >
    > > use OpenOffice::OODoc;
    > > my $doc = odfDocument(file => 'iwm.ods');

    >
    > > $row = 3;
    > > while ( my $cli = $doc->cellValue(0, "D$row") ) {
    > >     my $username = get_customer_account( $dbh, $cli );
    > >     print "$cli => $username\n";
    > >     $doc->cellValue(0, "E$row", $username);
    > >     $row++;
    > > }

    >
    > > $doc->save();

    >
    > > It's reading the spreadsheet fine, but it's not inserting the new
    > > value into 'E' column

    >
    > Try
    > $doc->updateCell(0, "E$row", $username);


    Thanks, but I had already tried that, the problem I think is that
    the table (0) I want to insert a fifth column into is only 4 columns
    wide (when I open the spreadsheet you can see bold black outline
    around the overall table size), I tried expanding the table but that
    only seemed to widen the very last line of the table. I guess I
    should just write a brand new table based on the old table and
    delete the old table, but that seems rather crude.
    Grehom, Nov 20, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. alf
    Replies:
    7
    Views:
    429
    Sybren Stuvel
    Sep 4, 2006
  2. HokBen
    Replies:
    0
    Views:
    743
    HokBen
    Nov 9, 2006
  3. News123
    Replies:
    0
    Views:
    288
    News123
    Apr 28, 2010
  4. Torsten Mohr

    Read / Write OpenOffice SpreadSheet ?

    Torsten Mohr, Dec 17, 2010, in forum: Python
    Replies:
    10
    Views:
    834
    Hans-Peter Jansen
    Dec 18, 2010
  5. Skip Montanaro

    Reading OpenOffice spreadsheet in Python?

    Skip Montanaro, May 20, 2014, in forum: Python
    Replies:
    6
    Views:
    79
    Skip Montanaro
    May 21, 2014
Loading...

Share This Page