Skip to content
← Back to Community
Google Spreadsheet API in flask python
Profile icon
slip1244

How can I import all the necessary packages in? I tried using "import oauth2client" but it shows this error message.
This file cannot be displayed: https://storage.googleapis.com/replit/images/1538666682543_a05ba6e4d9c68a03d580ee2a55f4f1be.pn

Answered by timmy_i_chen [earned 5 cycles]
View Answer
Voters
Profile icon
StarkLu
Profile icon
RebeccaPollard
Profile icon
slip1244
Comments
hotnewtop
Profile icon
timmy_i_chen

Have you tried installing it using the package manager in the sidebar? :)

Profile icon
slip1244

@timmy_i_chen whoa, thanks so much

Profile icon
JohnKershaw

@nithilan4 I'm trying to write a scraper for Google Classroom. The packages hint got me past the oauth2 error, but now instead I get a message saying it wants to authorise me in the browser, and if not, I should add:

--noauth_local_webserver

I have a credentials.json with valid (I think) credentials. Did you get yours working?

Profile icon
slip1244

@JohnKershaw yup, import pygsheets, so nice

Profile icon
slip1244

@JohnKershaw

import pygsheets import pandas as pd def write(topp1, topp2, topp3): name=input("What is the name of the google doc?") #authorization gc = pygsheets.authorize(service_file='client_secret.json') #YOUR SECRET CODE THING # Create empty dataframe df = pd.DataFrame() # Create a column df['stuff'] = ["help", "me"] #stuff is title, help, and me, are the rows below #open the google spreadsheet (where 'PY to Gsheet Test' is the name of my sheet) sh = gc.open('NAME OF SPREADSHEET') #select the first sheet wks = sh[0] #update the first sheet with df, starting at cell B2. wks.set_dataframe(df,(1,1))
Profile icon
timmy_i_chen

@nithilan4 btw you can use markdown here - something like

```python # your code here ```

(except have the backticks line up :) )

Profile icon
slip1244

@timmy_i_chen oof okay

Profile icon
JohnKershaw

@nithilan4 Thanks - I'll give it a try!