NAME

Google::RestApi::SheetsApi4::Spreadsheet - Represents a Google Spreadsheet.

DESCRIPTION

See the description and synopsis at Google::RestApi::SheetsApi4.

SUBROUTINES

new(sheets => <SheetsApi4>, (id => <string> | name => <string> | title => <string> | uri => <string>), cache_seconds => <int>);

Creates a new instance of a Spreadsheet object. You would not normally call this directly, you would obtain it from the Sheets::open_spreadsheet routine.

sheets: The parent SheetsApi4 object.
id: The id of the spreadsheet (Google Drive file ID).
name: The name of the spreadsheet (as shown in Google Drive).
title: An alias for name.
uri: The spreadsheet ID extracted from the overall URI.
cache_seconds: Cache information for this many seconds (default to 5, 0 disables).

Only one of id/name/title/uri should be specified and this API will derive the others as necessary.

The cache exists so that repeated calls for the same attributes or worksheet properties doesn't keep hammering the Google API over and over. The default is 5 seconds. See 'cache_seconds' below.

api(%args);

Calls the parent SheetsApi4's 'api' routine with the Sheet's endpoint, along with any args to be passed such as content, params, headers, etc.

You would not normally call this directly unless you were making a Google API call not currently supported by this API framework.

spreadsheet_id();

Returns the spreadsheet id (the Google Drive file id).

spreadsheet_uri();

Returns the URI of this spreadsheet.

spreadsheet_name();

Returns the name of the spreadsheet.

spreadsheet_title();

An alias for 'spreadsheet_name'.

attrs(fields<string>);

Returns the spreadsheet attributes of the specified fields.

properties(properties<string>);

Returns the spreadsheet property attributes of the specified fields.

worksheet_properties(what<string>);

Returns an array ref of the properties of the worksheets owned by this spreadsheet.

cache_seconds(<int>)

Sets the caching time in seconds. Calling will always delete the existing cache. 0 also disables the cache.

delete_all_protected_ranges();

Deletes all the protected ranges from all the worksheets owned by this spreadsheet.

named_ranges(name<string>);

Returns the properties of the named range passed, or if false is passed, all the named ranges for this spreadsheet.

copy_spreadsheet(%args);

Creates a copy of this spreadsheet and passes any args to the Google Drive File copy routine.

delete_spreadsheet();

Deletes this spreadsheet from Google Drive.

range_group(range<array>...);

Creates a range group with the contained ranges.

tie(ranges<hash>);

Ties the given 'key => range' pairs into a tied range group. The range group can be used to send batch values (API batchUpdate) and batch requests (API batchRequests) as a single call once all the changes have been made to the overall hash.

Turning on the 'fetch_range' property will return the underlying ranges on fetch so that formatting for the ranges can be set. You would normally only turn this on for a short time, and turn it off when the underlying batch requests have been submitted.

$tied = $ss->tie(id => $range_cell);
$tied->{id} = 1001;
tied(%$tied)->submit_values();

tied(%$tied)->fetch_range(1);
$tied->{id}->bold()->red()->background_blue();
tied(%$tied)->fetch_range(0)->submit_requests();

See also Google::RestApi::SheetsApi4::Worksheet::tie.

submit_values(values<arrayref>, content<hashref>);

Submits the batch values (Google API's batchUpdate) for the specified ranges. Content is passed to the SheetsApi4's 'api' call for any customized content you may need to pass.

submit_requests(requests<arrayref>, content<hashref>);

Submits any outstanding requests (Google API's batchRequests) for this spreadsheet. content will be passed to the SheetsApi4's 'api' call for any customized content you may need to pass.

protected_ranges();

Returns all the protected ranges for this spreadsheet.

open_worksheet(%args);

Creates a new Worksheet object, passing the args to that object's 'new' routine (which see).

sheets_api();

Returns the SheetsApi4 object.

stats()

Shows some statistics on how many get/put/post etc calls were made. Useful for performance tuning during development.

AUTHORS

  • Robin Murray mvsjes@cpan.org

COPYRIGHT

Copyright (c) 2019, Robin Murray. All rights reserved.

This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.