I want to work with Google SpreadSheet in python.
Various settings such as enabling the API of Google Drive and Sheets, sharing the sheet, issuing the private key, etc. have been completed.
I'm writing code to operate Google SpreadSheet with python.
I am stuck in the process of setting the authentication information (service account key) and logging in to the Google API.
! pip install gspread ! pip install oauth2client import json import gspread from oauth2client.service_account import ServiceAccountCredentials Get credentials using #json file SCOPES = ['https://spreadsheets.google.com/feeds','https://www.googleapis.com/auth/drive'] SERVICE_ACCOUNT_FILE ='my-project-test-296177.json' credentials = ServiceAccountCredentials.from_json_keyfile_name (SERVICE_ACCOUNT_FILE, SCOPES)
217 the keyfile. 218 "" " ->219 with open (filename,'r') as file_obj: 220 client_credentials = json.load (file_obj) 221 return cls._from_parsed_json_keyfile (client_credentials, scopes, FileNotFoundError: [Errno 2] No such file or directory:'my-project-test-296177.json'
I get an error.
I knew I could enter the downloaded JSON file name.json, but I'm not sure what that was.
If anyone can understand it, I would like you to teach me. Thank you.
Answer # 1
If the json file is in the same folder as the py file you want to execute, you can omit the path specification,
If it is in a different folder, you need to specify the path.
SERVICE_ACCOUNT_FILE = r'C: \ Users \ username \ Desktop \ folder name \ my-project-test-296177.json'
- i want to operate a spreadsheet from python and execute it from vba
- python 3x - i can't mount it properly with google colab
- google spreadsheets - google spreadsheet: when you want to use query/importrange and further narrow down by contains
- about cooperation of python csv spreadsheet
- python - i want to paste excel data into a spreadsheet
- python 27 - type error when running in google colaboratory
- python - about error no such file or directory on google colab
- google api - i can't scrape using spreadsheet
- [google spreadsheet] i want to be able to search for pull-down items
- python - about errors in google colaboratory
- google spreadsheets - i want to get the data selected by pulling down the spreadsheet in gas
- google spreadsheets - spreadsheet query (date> handling of blank cells in today's conditional extraction)
- python - i want to remodel line is there a line version of the google extension?
- python - how to specify the license when using the google custom search api
- google spreadsheets - i want to copy the original sheet in a spreadsheet and rename the sheet in the specified cell of the speci
- i want to operate an excel user form with python
- google apps script - i want to image (or html) a spreadsheet table
- google apps script - in the spreadsheet, i want to set the trigger of the project at the time of editing and make it work only w
- python - i want to scrape google news, but i can't
- python - you may need to restart the kernel to use updated packages error
- php - coincheck api authentication doesn't work
- php - i would like to introduce the coincheck api so that i can make payments with bitcoin on my ec site
- [php] i want to get account information using coincheck api
- the emulator process for avd pixel_2_api_29 was killed occurred when the android studio emulator was started, so i would like to
- python 3x - typeerror: 'method' object is not subscriptable
- i want to call a child component method from a parent in vuejs
- dart - flutter: the instance member'stars' can't be accessed in an initializer error
- xcode - pod install [!] no `podfile 'found in the project directory