Skip to content

Instantly share code, notes, and snippets.

Created April 5, 2017 11:31
What would you like to do?
from google import spreadsheet
class WorkSheet(object):
spreadsheetId = ''
def __init__(self, spreadsheetId):
self.spreadsheetId = spreadsheetId
def get(self, range):
result = spreadsheet().spreadsheets().values().get(
spreadsheetId=self.spreadsheetId, range=range
return result.get('values', [])
def update(self, range, body):
spreadsheetId=self.spreadsheetId, range=range,
valueInputOption="USER_ENTERED", body=body
if __name__ == '__main__':
worksheet = WorkSheet("spreadsheetId")
# A列からC列までの値を取得
# E1とG1に値を挿入
worksheet.update('E1:G1', {'values': [1,2]})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment