Skip to content

Instantly share code, notes, and snippets.

@fejt
Created December 17, 2019 11:04
Show Gist options
  • Save fejt/086cf0e1379b652a169eec7094da35f6 to your computer and use it in GitHub Desktop.
Save fejt/086cf0e1379b652a169eec7094da35f6 to your computer and use it in GitHub Desktop.
Python
from oauth2client.service_account import ServiceAccountCredentials
import gspread
 
scope = ['https://spreadsheets.google.com/feeds',
         'https://www.googleapis.com/auth/drive']
 
credentials = ServiceAccountCredentials.from_json_keyfile_name('creds.json', scope)
gc = gspread.authorize(credentials)
 
sht1 = gc.open_by_url('https://docs.google.com/spreadsheets/d/19281OqG_UfOPL43QsbfvSa6zGK1b0IvaNZfpMam_vQk/edit?folder=0AEGcPXlb7cMeUk9PVA#gid=0')
 
content = open('input.csv', 'r').read()
gc.import_csv('19281OqG_UfOPL43QsbfvSa6zGK1b0IvaNZfpMam_vQk', content)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment