| Net-Google-Spreadsheets documentation | Contained in the Net-Google-Spreadsheets distribution. |
Net::Google::Spreadsheets::Cell - A representation class for Google Spreadsheet cell.
use Net::Google::Spreadsheets;
my $service = Net::Google::Spreadsheets->new(
username => 'mygoogleaccount@example.com',
password => 'mypassword',
);
# get a cell
my $cell = $service->spreadsheet(
{
title => 'list for new year cards',
}
)->worksheet(
{
title => 'Sheet1',
}
)->cell(
{
col => 1,
row => 1,
}
);
# update a cell
$cell->input_value('new value');
# get the content of a cell
my $value = $cell->content;
Rewritable attribute. You can set formula like '=A1+B1' or so.
Read only attribute. You can get the result of formula.
http://code.google.com/intl/en/apis/spreadsheets/docs/3.0/developers_guide_protocol.html
http://code.google.com/intl/en/apis/spreadsheets/docs/3.0/reference.html
Nobuo Danjou <nobuo.danjou@gmail.com>
| Net-Google-Spreadsheets documentation | Contained in the Net-Google-Spreadsheets distribution. |
package Net::Google::Spreadsheets::Cell; use Any::Moose; use XML::Atom::Util qw(first); with 'Net::Google::DataAPI::Role::Entry'; has content => ( isa => 'Str', is => 'ro', ); has row => ( isa => 'Int', is => 'ro', ); has col => ( isa => 'Int', is => 'ro', ); has input_value => ( isa => 'Str', is => 'rw', trigger => sub {$_[0]->update}, ); after from_atom => sub { my ($self) = @_; my $elem = first( $self->elem, $self->ns('gs')->{uri}, 'cell'); $self->{row} = $elem->getAttribute('row'); $self->{col} = $elem->getAttribute('col'); $self->{input_value} = $elem->getAttribute('inputValue'); $self->{content} = $elem->textContent || ''; }; around to_atom => sub { my ($next, $self) = @_; my $entry = $next->($self); $entry->set($self->ns('gs'), 'cell', '', { row => $self->row, col => $self->col, inputValue => $self->input_value, } ); my $link = XML::Atom::Link->new; $link->rel('edit'); $link->type('application/atom+xml'); $link->href($self->editurl); $entry->link($link); $entry->id($self->id); return $entry; }; __PACKAGE__->meta->make_immutable; no Any::Moose; 1; __END__