Google::RestApi::SheetsApi4::Request - A base class to build Google API's batchRequest.


A Request is a lightweight object that is used to collect and then submit a number of batch requests such as formatting, spreadsheet properties, worksheet properties etc.

Other classes in this api derive from this object and its child objects. You would not normally have to interact with this object directly as it is already built in to the other classes in this api. It is documented here for background understanding.

Batch requests are formulated and queued up to be submitted later via 'submit_requests'. This class hierarchy encapsulates the tedious work of constructing the complex, deep hashes required for cell formatting or setting various properties.

 Spreadsheet: Derives from Request::Spreadsheet.
 Worksheet: Derives from Request::Spreadsheet::Worksheet.
 Range: Derives from Request::Spreadsheet::Worksheet::Range.

A Spreadsheet object can only submit requests that have to do with spreadsheets. A Worksheet object can submit requests that have to do with worksheets, and also for parent spreadsheets. A Range object can submit requests that have to do with ranges, worksheets, and spreadsheets.

In some cases, multiple calls for the same-named request can be merged into a single request. For example $range->bold()->blue()->center() targets three Google API requests of the same name: 'repeatCell'. Instead of sending three small 'repeatCell' requests, these are all merged together into one 'repeatCell' request for efficiency.

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



Returns all the queued requests if none is passed, or adds the passed request to the queue. A request may be merged into an already-existing request of the same name.


This is a pure virtual function that must be overridden in the derived class. The derived class must decide what to do when the queued requests are ready to be sumitted. It must eventually pass the requests to the parent SheetsApi4 object.


  • Robin Murray


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.