Created
July 6, 2013 13:08
-
-
Save s2kw/5939825 to your computer and use it in GitHub Desktop.
初めてのRuby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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