Skip to content

Feature: allow batching of different request types #1580

Description

@karoush1

Is your feature request related to a problem? Please describe.
The Google Sheets API provides a way to execute multiple different actions (e.g. update, format, add validation, etc) in batches, essentially consuming only 1 request.

Currently GSpread has many actions that execute one single type of action in batches (e.g. batch_format, batch_update, etc, but is, as far as I am aware, unable to process in batches different request types.

Describe the solution you'd like
My initial idea is to include a private attribute _request_queue = [] and a method execute_request_queue()to the Worksheet class, and every function would include a new optional argument lazy=False. Default value of False would keep behavior the same, but a value of True would append all requests to the _request_queue. When the function execute_request_queue is called, it would pass all requests to the low-level function batch_update from the Spreadsheet class.

Describe alternatives you've considered
As far as I am aware, there is no documentation or issue opened about this feature.

Additional context
This idea came from my workplace, where we share a project account to automate stuff that uses the Google related APIs.

While I was using batching to edit the spreadsheets, because so many people use the account and don't batch the requests, I end up getting a resource exaution error.

By being able to execute everything with one request, I would be able to do everything the automation script requires, and because it would be added to a queue to be executed later, I can keep adding to the queue while I wait for the backoff timer to try again.

Sorry if I ended up forgetting about an important detail.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions