Ruby google_drive gem问题

时间:2014-03-17 15:23:02

标签: ruby google-drive-api

https://github.com/gimite/google-drive-ruby

谷歌文档似乎有更新。现在新的谷歌文档中有一个“插件”功能。有人找到了解决新版谷歌文档和google_drive gem的工作吗?

require 'google_drive'

session = GoogleDrive.login("username@gmail.com", "password")

# the key is found in the url of a google doc web address
# https://docs.google.com/a/pz7XtlQC-PYx-jrVMJErTcg#gid=0    

ws = session.spreadsheet_by_key("pz7XtlQC-PYx-jrVMJErTcg").worksheets[0]


ws.rows
=> ERRORS
ws[1,1]
=> "test" 

ws[1,1] = "hi"
ws.save()
=> ERRORS 

有没有人有解决方法?

1 个答案:

答案 0 :(得分:1)

从版本0.3.8 gem支持新的Spreadsheets。 此外,您可以尝试 spreadsheer_by_url 方法。 例如:

require 'google_drive'

session = GoogleDrive.login("username@gmail.com", "password")

ws = session.spreadsheet_by_url('https://docs.google.com/a/pz7XtlQC-PYx-jrVMJErTcg#gid=0').worksheets[0]