gspread icon indicating copy to clipboard operation
gspread copied to clipboard

gspread and Matplotlib don't seem to work together

Open dhruvv opened this issue 6 years ago • 2 comments

I have some simple gspread code gc = gspread.service_account(filename="D:\\file.json") sh = gc.open("Auction2_SEL") sheet1 = sh.get_worksheet(0) row0 = sheet1.row_values(2) print(row0)

And this works fine. It prints the data from the Google Sheet

There is some data there that I would like to place in a Matplotlib graph. However, as soon as I try to add the import matplotlib as plt line to my code, I get a 400 APIError Code with PLT added

import matplotlib as plt import gspread gc = gspread.service_account(filename="D:\\file.json") sh = gc.open("Auction2_SEL") sheet1 = sh.get_worksheet(0) row0 = sheet1.row_values(2) print(row0)

gives gspread.exceptions.APIError: {'code': 400, 'message': "Unable to parse range: 'players_20'!A0:0", 'status': 'INVALID_ARGUMENT'}

dhruvv avatar Jul 19 '20 09:07 dhruvv

Thanks for reporting. I'm not convinced that importing matplotlib could influence gspread behavior in any way. The error tells that somehow you're trying to get range A0:0 which does not exist. Are you sure that this API error results from calling the code above and not from sheet1.row_values(0)?

burnash avatar Jul 21 '20 13:07 burnash

Yeah, it looked like I accidentally named a file in my path matplotlib.py and it imported that, which contained the line causing the problem. I'll close this issue now since it's not an issue at all.

dhruvv avatar Jul 21 '20 13:07 dhruvv