Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
272 views
in Technique[技术] by (71.8m points)

api - Need help getting started with the EZSheets python module

I am setting up the EZsheets python module by the instructions on the documentation here https://ezsheets.readthedocs.io/en/latest/

Before you can use EZSheets, you need to enable the Google Sheets and Google Drive APIs for your Google account. https://console.developers.google.com/apis/library/sheets.googleapis.com/ https://console.developers.google.com/apis/library/drive.googleapis.com/

Both are enabled.

You’ll also need to obtain three files, which you should save in the same folder as your .py Python script that uses EZSheets:

  • A credentials file named credentials-sheets.json
  • A token for Google Sheets named token-sheets.pickle*
  • A token for Google Drive named token-drive.pickle

The easiest way to obtain a credentials file is to go to the Google Sheets Python Quickstart page at https://developers.google.com/sheets/api/quickstart/python/ and click the blue Enable the Google Sheets API button. Clicking this button will bring up a window with a Download Client Configuration link that lets you download a credentials.json file. Rename this file to credentials-sheets.json and place it in the same folder as your Python scripts.

I go to the link, and download the file, rename it and put in my folder with the python script.

Once you have a credentials-sheets.json file, run the import ezsheets module. The first time you import the EZSheets module, it will open a new browser window for you to log in to your Google account. Click Allow. The message about Quickstart comes from the fact that you downloaded the credentials file from the Google Sheets Python Quickstart page. Note that this window will open twice: first for Google Sheets access and second for Google Drive access. EZSheets uses Google Drive access to upload, download, and delete spreadsheets.

This is that part I am stuck at. When I attempt to run the file nothing happens I get no windowed prompt.

If I edit the file and add ""ss = ezsheets.createSpreadsheet(title='My New Spreadsheet')"" after the import statement I get an error message ending in

"C:UsersMYNAMEAppDataLocalPackagesPythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0LocalCachelocal-packagesPython38site-packagesezsheets_init_.py", line 1669, in init raise EZSheetsException( ezsheets.EZSheetsException: Can't find credentials file at c:UsersMYNAMEDocumentscodeprojectssetcredentials-sheets.json. You can download this file from https://developers.google.com/sheets/api/quickstart/python and clicking "Enable the Google Sheets API". Rename the downloaded file to credentials-sheets.json.

It tells me it cant find the credentials at the credentials files location? Not sure what I am doing wrong here any help is appreciated, thank you!

question from:https://stackoverflow.com/questions/65851917/need-help-getting-started-with-the-ezsheets-python-module

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...