question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'Worksheet' object has no attribute 'get_values'

See original GitHub issue

Describe the bug Today I started to get this error in Google Colab… ‘Worksheet’ object has no attribute ‘get_values’ Yesterday I had a problem in the authorization to connect with gspread, but it was resolved. But now this error appeared despite the code being the same.

To Reproduce Try to use this following code with google colab (with some personal worksheet):

!pip install --upgrade gspread
!apt-get update # to update ubuntu to correctly run apt install

import gspread
from google.colab import auth
from google.auth import default

auth.authenticate_user()
creds, _ = default()
gc = gspread.authorize(creds)

url_sheet = "https://docs.google.com/spreadsheets/d/.../"
sheet = gc.open_by_url(url_sheet)
wsheet_values = sheet.worksheet('Sheet Name').get_values('A:G') #line with error

You can also try to import just the function:

from gspread.worksheet.Worksheet import get_values

And it returns to me this error: “cannot import name ‘Dimension’ from ‘gspread.utils’ (/usr/local/lib/python3.7/dist-packages/gspread/utils.py)”

Expected behavior It was suposed to return the data in the specified range as lists within a list

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
lavigne958commented, Mar 31, 2022

I just solved the problem replacing “get_values” with “get”, but I still don’t know why it stopped accepting “get_values”.

Be aware you did not solve your problem, you only worked around it. This workaround is very close but there is a difference betweenget and get_values

get will return the range you request. get_values will return the range but it will keep the shape of the range and put empty values when the cells are empty. In get you don’t receive the empty values.

Make sure this does not brake your script.

1reaction
lavigne958commented, Mar 30, 2022

In fact this is odd. It looks like some import broke down in the latest release. I will look at it

Read more comments on GitHub >

github_iconTop Results From Across the Web

'Worksheet' object has no attribute 'get_values' - Stack Overflow
I just solved the problem replacing "get_values" with "get": url_sheet = "https://docs.google.com/spreadsheets/d/.../" sheet ...
Read more >
Getting error " 'NoneType' object has no attribute 'getvalues' "
[Solved]-Getting error " 'NoneType' object has no attribute 'getvalues' "-Pandas,Python ... The conflict comes from keeping the same names for different objects.
Read more >
The Workbook Class — XlsxWriter Documentation
The Worksheet object is used to write data and configure a worksheet in the workbook. The name parameter is optional. If it is...
Read more >
Class Sheet | Apps Script - Google Developers
Returns the URL for the form that sends its responses to this sheet, or null if this sheet has no associated form. getFrozenColumns(),...
Read more >
Reading Spreadsheets with OpenPyXL and Python
Read all cells in all sheets. You can get started by learning how to open a workbook in the next section! Open a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found