Skip to content

Instantly share code, notes, and snippets.

@metahertz
Created March 29, 2021 10:47
Show Gist options
  • Save metahertz/9e268f4eb85be7dd2d0db3886db5cd5f to your computer and use it in GitHub Desktop.
Save metahertz/9e268f4eb85be7dd2d0db3886db5cd5f to your computer and use it in GitHub Desktop.
import gspread
from oauth2client.service_account import ServiceAccountCredentials
scope = ['https://spreadsheets.google.com/feeds']
credentials = ServiceAccountCredentials.from_json_keyfile_name('client_secret.json', scope)
gc = gspread.authorize(credentials)
# Open a worksheet from spreadsheet with one shot
wks = gc.open("sheetname").sheet1
wks.update_acell('B2', "SellValue")
# Fetch a cell range
cell_list = wks.range('A1:B7')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment