The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::Google::Spreadsheets::Table - A representation class for Google Spreadsheet table.

SYNOPSIS

  use Net::Google::Spreadsheets;

  my $service = Net::Google::Spreadsheets->new(
    username => 'mygoogleaccount@example.com',
    password => 'mypassword',
  );

  # get a table
  my $table = $service->spreadsheet(
    {
        title => 'list for new year cards',
    }
  )->table(
    {
        title => 'sample table',
    }
  );

  # create a record
  my $r = $table->add_record(
    {
        name => 'Nobuo Danjou',
        nick => 'lopnor',
        mail => 'danjou@soffritto.org',
        age  => '33',
    }
  );

  # get records
  my @records = $table->records;

  # search records
  @records = $table->records({sq => 'age > 20'});
  
  # search a record 
  my $record = $table->record({sq => 'name = "Nobuo Danjou"'});

METHODS

records(\%condition)

Returns a list of Net::Google::Spreadsheets::Record objects. Acceptable arguments are:

  • sq

    Structured query on the full text in the worksheet. see the URL below for detail.

  • orderby

    Set column name to use for ordering.

  • reverse

    Set 'true' or 'false'. The default is 'false'. It reverses the order.

See http://code.google.com/intl/en/apis/spreadsheets/docs/3.0/reference.html#RecordParameters for details.

record(\%condition)

Returns first item of records(\%condition) if available.

add_record(\%contents)

Creates new record and returns a Net::Google::Spreadsheets::Record object representing it. Arguments are contents of a row as a hashref.

  my $record = $table->add_record(
    {
        name => 'Nobuo Danjou',
        nick => 'lopnor',
        mail => 'danjou@soffritto.org',
        age  => '33',
    }
  );

CAVEATS

You can access to the table structure and records only from the Google Spreadsheets API. It means you can't create tables, add records or delete tables via web interface. It will make some problems if you want to access the data both from API and web interface. In that case, you should use $worksheets->row(s) methods instead. See the documents below for details:

http://code.google.com/intl/en/apis/spreadsheets/data/3.0/developers_guide_protocol.html#TableFeeds

SEE ALSO

https://developers.google.com/google-apps/spreadsheets/

Net::Google::AuthSub

Net::Google::Spreadsheets

Net::Google::Spreadsheets::Spreadsheet

Net::Google::Spreadsheets::Record

AUTHOR

Nobuo Danjou <danjou@soffritto.org>