burnash / burnash/gspread

Using batch_get for multiple pages such as spreadsheets.values.batchGet supports

Open
#1,098 2 comments 0 reactions 1 assignee Claimed by @lavigne958 View on GitHub
Feature Request Need investigation
Dominant language
Python
Stars
7.5k
Forks
979
PR merge metrics
No merged PRs in 30d

Description

I tried using `batch_get` to collect values in a single call:
```
sheet = client.open_by_key('XXXXXXXXXXXXXXXXXXXXXXXX')
print(sheet.batch_get(["'Page 1'!A1:A5","'Page 2'!A1:A5"]))
```
But I realized that it only accepts by setting the desired page after `open_by_key`, like `open_by_key('...').worksheet('...')`.
That way are limited to using it on a single page.

I would like to request an "update" to this option that gives us the freedom to work with multiple pages in a single call, as is possible through the API (https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/batchGet):

![image](https://user-images.githubusercontent.com/58320500/182054939-1a9e60e5-f058-4d30-8fbc-ad7e5f0e86e1.png)

![image](https://user-images.githubusercontent.com/58320500/182054321-f245213b-14bd-44f1-9705-23eafb6add77.png)
```
{
"spreadsheetId": "XXXXXXXXXXXXXXXXXXXXXXXX",
"valueRanges": [
{
"range": "'Page 1'!A1:A5",
"majorDimension": "ROWS",
"values": [
[
"id"
],
[
"1"
],
[
"2"
],
[
"3"
],
[
"4"
]
]
},
{
"range": "'Page 2'!A1:A5",
"majorDimension": "ROWS",
"values": [
[
"id"
],
[
"1"
],
[
"2"
],
[
"3"
],
[
"4"
]
]
}
]
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.