Skip to content

Instantly share code, notes, and snippets.

@s2kw
Created July 6, 2013 13:08
Show Gist options
  • Save s2kw/5939825 to your computer and use it in GitHub Desktop.
Save s2kw/5939825 to your computer and use it in GitHub Desktop.
初めてのRuby
require "google_drive"
session = GoogleDrive.login( acc, pass) # セッションを取得
ss = session.spreadsheet_by_key('key') # keyはURLに入ってるパラメータ
ws = ss.worksheet_by_title('title') # googleはワークシートって言ってなかった気がするけどworksheetで取得する
p ws.rows # これで中身みれる
max_r = ws.max_rows()
max_c = ws.max_cols()
for rows in 1..max_r # cellにアクセスするので1から。配列なら0からだけど。
for cols in 1..max_c # 実際、0で開始するとエラーが出る。
p ws[rows, cols]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment