Python Forum
Linking python to Google Sheets
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Linking python to Google Sheets
#1
When trying to link python with this code

import gspread
from oauth2client.service_account import ServiceAccountCredentials

from pprint import pprint

scope = ["https://spreadsheets.google.com/feeds",'https://www.googleapis.com/auth/spreadsheets',"https://www.googleapis.com/auth/drive.file","https://www.googleapis.com/auth/drive"]

creds = ServiceAccountCredentials.from_json_keyfile_name("client_secret.json", scope)

client = gspread.authorize(creds)

sheet = client.open("Cohort 2020 Teacher Assessment").sheet1  # Open the spreadhseet
This error code appears

Error:
Traceback (most recent call last): File "C:\Users\charl\Desktop\Cohort 2020 Folder\spreadsheets.py", line 10, in <module> client = gspread.authorize(creds) File "C:\Users\charl\AppData\Local\Programs\Python\Python37-32\lib\site-packages\gspread\__init__.py", line 38, in authorize client.login() File "C:\Users\charl\AppData\Local\Programs\Python\Python37-32\lib\site-packages\gspread\client.py", line 51, in login self.auth.refresh(http) File "C:\Users\charl\AppData\Local\Programs\Python\Python37-32\lib\site-packages\oauth2client\client.py", line 545, in refresh self._refresh(http) File "C:\Users\charl\AppData\Local\Programs\Python\Python37-32\lib\site-packages\oauth2client\client.py", line 749, in _refresh self._do_refresh_request(http) File "C:\Users\charl\AppData\Local\Programs\Python\Python37-32\lib\site-packages\oauth2client\client.py", line 780, in _do_refresh_request body=body, headers=headers) File "C:\Users\charl\AppData\Local\Programs\Python\Python37-32\lib\site-packages\oauth2client\transport.py", line 282, in request connection_type=connection_type) File "C:\Users\charl\AppData\Local\Programs\Python\Python37-32\lib\site-packages\httplib2\__init__.py", line 1953, in request cachekey, File "C:\Users\charl\AppData\Local\Programs\Python\Python37-32\lib\site-packages\httplib2\__init__.py", line 1618, in _request conn, request_uri, method, body, headers File "C:\Users\charl\AppData\Local\Programs\Python\Python37-32\lib\site-packages\httplib2\__init__.py", line 1524, in _conn_request conn.connect() File "C:\Users\charl\AppData\Local\Programs\Python\Python37-32\lib\site-packages\httplib2\__init__.py", line 1307, in connect self.sock = self._context.wrap_socket(sock, server_hostname=self.host) File "C:\Users\charl\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 412, in wrap_socket session=session File "C:\Users\charl\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 853, in _create self.do_handshake() File "C:\Users\charl\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 1117, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)
any ideas on how to fix this, i have tried installing the latest gspread and oauth2client however still no hope
Reply
#2
What makes you think that code will work? If you're following a tutorial, please post the link here.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  (Python) Pulling data from UA Google Analytics with more than 100k rows into csv. Stockers 0 1,170 Dec-19-2022, 11:11 PM
Last Post: Stockers
Lightbulb Help using Google Sheets matheuspimenta 0 687 Dec-15-2022, 05:36 PM
Last Post: matheuspimenta
  How to loop through all excel files and sheets in folder jadelola 1 4,331 Dec-01-2022, 06:12 PM
Last Post: deanhystad
  Deploy Python to Cloud and save output to Google Drive chandrabr80 2 1,524 Jan-25-2022, 06:56 AM
Last Post: ndc85430
  Compare two Excel sheets with Python and list diffenrences dmkfon 1 14,489 Oct-09-2021, 03:30 PM
Last Post: Larz60+
  install apache-airflow[postgres,google] on Python 3.8.12 virtual env ShahajaK 1 6,350 Oct-07-2021, 03:05 PM
Last Post: Larz60+
  identical cells in 2 different excel sheets python pandas esso 0 1,598 Jul-19-2020, 07:50 PM
Last Post: esso
  error in Linking two coroutines shankar 3 5,512 Jun-19-2020, 06:50 PM
Last Post: gogawaleankita
  how to import files in Google Collab wihout downloading them to PC and to Google Disk sveto4ka 9 3,802 Jun-03-2020, 12:40 PM
Last Post: sveto4ka
  linking with excel mhmdbarazi 1 2,008 Apr-23-2020, 04:18 AM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020