`get_values` does not return all data in some scenarios with empty data
See original GitHub issueHello! Thanks for your time. I wanted to report a potential bug in the get_values
function. When you have a spreadsheet that has say 6 columns with headers, where data should be and you make a query for a particular row, there is a certain scenario where empty data fields are not returned. This can be confusing for downstream users of the gspread API who want to say, convert the row into a dictionary (ala get_all_records
).
This scenario occurs when data is laid out like this:
header1, header2, header3, header4, header5, header6
x1, , , x4, ,
In that data above header5 and header6 are empty for the first row. Suppose you made this call:
ws.get_values("A1:1")
You only get back:
[['x1',,,'x4']]
As opposed to what I would expect:
[['x1',,,'x4',,]]
Minimal reproducer:
(Pdb++) ws.get_values("A7:7")
[['', 'kl3020', '', '07/26/2021']]
Expected result:
(Pdb++) ws.get_values("A7:7")
[['', 'kl3020', '', '07/26/2021', '', '']]
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (3 by maintainers)
Top Results From Across the Web
Stuck on SqlDataReader.GetValues Method - Stack Overflow
To accomplish this, it seems that the GetValues method would return what I need, which is the entire dataset the stored procedure is...
Read more >Retrieve Rows from Google Spreadsheet with Google Apps ...
The concept of data range is important since some rows may not have data in all columns, so blank values will be included...
Read more >useForm - getValues - React Hook Form
An optimized helper for reading form values. The difference between watch and getValues is that getValues will not trigger re-renders or subscribe to...
Read more >Retrieving Data | Firebase Realtime Database - Google
That means the SDK does not register any callbacks that listen to subsequent data updates. This model of data retrieval is supported in...
Read more >Reading from and writing to a Range in Google Sheets using ...
This tutorial will walk you through several ways to read data from and write data to your Google Sheets spreadsheet using Google Apps...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You’re right, issue re-open. If you have a PR ready feel free to open it I’ll review it.
Thanks.
This is sample worksheet with name ‘test’
* in this example, _(underbar) means empty cell
* ROWs : 1 … 6 // COLs : A … F
case 1. when requesting values A1:E3 (expectable)
case 2. when requesting values C1:E3 (expectable)
case 3. when requesting values A1:F2 (expectable)
edit added : use case for pandas.DataFrame
case 4. when requesting values A2:F2 (quite not expectable)
what some people would have expected :
comparing with case 2 and case 4,
we could know google search from left to right
but don’t take into account when cell is empty
just like they are using
str.rstrip()
python string methodtl;dr google spread request return results after using
rstrip()
-like methodany thing to fix?