Python3でgoogleスプレッドシートを使ってみる。
Python3 でgoogleスプレッドシートを使ってみたので覚書として残します。
Google スプレッドシートの準備
Googleスプレッドシートで下記を有効にしますが、手順はコチラをご参照ください、
・Google Drive APIを有効
・Google Sheets API
Pythonプログラム
import gspread from oauth2client.service_account import ServiceAccountCredentials scope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive'] credentials = ServiceAccountCredentials.from_json_keyfile_name('<ダウンロードしたJSONファイル名>.json', scope) gc = gspread.authorize(credentials) wks = gc.open('test').sheet1 wks.update_acell('A3', 'Hello World!')