gimite / google-spreadsheet-ruby Goto Github PK
View Code? Open in Web Editor NEWRuby library to read/write Google Spreadsheet
License: Other
Ruby library to read/write Google Spreadsheet
License: Other
Hi,
trying to install or update the gem I receive this error:
sudo gem update
Updating installed gems
Updating gimite-google-spreadsheet-ruby
ERROR: While executing gem ... (Gem::FormatException)
gimite-google-spreadsheet-ruby-0.0.6 has an invalid value for @licenses
sudo ruby -v
ruby 1.8.7 (2010-06-23 patchlevel 299) [i686-linux]
sudo gem -v
1.7.1
Can you help me ?
HI gimite
When i connect google doc, it reports "ruby-1.8.7-p302/lib/ruby/1.8/net/http.rb:586:in `connect': Connection reset by peer - SSL_connect (Errno::ECONNRESET)"
Do you know why?
Thanks
Following call:
session = GoogleSpreadsheet.login(login, password)
spreadsheet = session.spreadsheet_by_key(spreedsheet_key)
ws = spreadsheet.worksheets[0]
produces:
Invalid expression: .//xmlns:link[@xmlns:@rel = 'http://schemas.google.com/spreadsheets/2006#cellsfeed']
I am using Rails 3.1 - this seems to work in IRB - I am not sure if there is something in Rails thats breaking it?
A hint would be appreciated. Thanks!
When there are non ASCII characters in a String the upload stops with a TimeOut Error.
Hello,
a user of my 'roo' gem sent me this email. Is this possible with your gem?
Hi
I am trying to open a spreadsheet hosted on my Google app-engine
account. But when i run the script, i get :
/usr/local/lib/ruby/gems/1.8/gems/gimite-google-spreadsheet-ruby-0.0.6/
lib/google_spreadsheet.rb:177:in get': Error 400 Bad Request for GET http://spreadsheets.google.com/feeds/worksheets/0Aji6nYSYa4b_dDRnOWNf... The spreadsheet at this URL could not be found. Make sure that you have the right URL and that the owner of the spreadsheet hasn't deleted it. (GoogleSpreadsheet::Error) from /usr/local/lib/ruby/gems/1.8/gems/gimite-google-spreadsheet- ruby-0.0.6/lib/google_spreadsheet.rb:305:in
worksheets'
from /usr/local/lib/ruby/gems/1.8/gems/roo-1.9.0/lib/roo/google.rb:
37:in initialize' from bulktest.rb:4:in
new'
from bulktest.rb:4
It is not a generic Google Account, so the spreadsheet is not located
at spreadsheets.google.com/ccc?key=XXXXX, but instead at
spreadsheets.google.com/a/domain.com/ccc?key=XXXXX. Has anyone come
across or better solved this error?
Thanks
What's the easiest way to copy a sheet from one domain to another?
I'm using the same two-legged OAuth credentials for both domains; access isn't a problem. I see an "export" method in the library, but not a corresponding "import".
When I add a new worksheet to a given spreadsheet, I can only successfully do so if I do not specify max_cols and max_rows in my call to add_worksheet.
For example, the following works:
w = spreadsheet.add_worksheet("I can haz worksheetz!?")
But the following, does not work:
w = spreadsheet.add_worksheet("I can haz worksheetz!?", 2, 10)
The second example results in an empty worksheet being created that has 0 rows and 0 cols and cannot be edited at all.
The workaround I've been using is to create a worksheet without max_rows and max_cols, then modify those values afterwards but it would be great to get that working in the initial call to add_worksheet.
Hi
I am using the gem to create folders and sub folders and assigning access to them. Looks simple enough - however I cannot get the app to work without getting a 'Time Error' or 'Response code 409 - user already has access to the folder'
Here is my requirement; I have 2 levels of folder
Main Folder [Read Access to group 1, group2 and group3]
-- Sub Folder 1 [Write Access to group 1 and group 2, no access to group 3]
-- Sub Folder 2 [Write Access to group 1 and group 3, no access to group 2]
The problem is each time is give read access to the 'Main Folder' the permission is cascaded down to sub folders 1 and 2. So each time I need to revoke the 'Read' access of each group on the Sub Folders to assign 'Write access'. It works fine until I make more than 3 consecutive requests. I get 'Time out Errors' or 'Response code 409 - user already has access to this folder' when trying to delete the Read access or assigning 'Write access'(I'm ensuring that I delete the 'Read Access' before assigning 'Write Access'.)
I wanted to know whether there is a time frame limitation on the calls I'm making or is there a better way of doing it.
My code can be found at http://paste.org/61663 (Apologies for the length of it - I'm sure there a better and faster way of doing it - your comments and advice are humbly accepted)
Thanks
Nawshine
When requesting a xml from the worksheet feed url, the Google API does not put the right URL in the link rel="alternate" href value, because it's always starts by spreadsheets.google.com and does not take into account Google Apps urls (that will add /a/domain.com after this).
If I'm right, the only way to have this value right is from the XML returned after a spreadsheet creation. Do you agree?
Say you are generating a multi worksheet spreadsheet and want to link your users into a specific worksheet via shared link.
For example:
https://docs.google.com/spreadsheet/ccc?key=0AgLNyeoMpvoYdDlzcGw1MVRXM0hiemd6V3VXYWFGb2c#gid=2
While you can generate the base URL, which will load the default spreadsheet, there is no way to query for the GID.
Affects
Version 0.1.8
def num_cols reload() if !@cells return @input_values.select(){ |(r, c), v| !v.empty? }.map(){ |(r, c), v| c }.max || 0 end
throws
undefined method `empty?' for 1:Fixnum
the session.spreadsheet_by_key will work with my OAuth2 token, but I get an error with session.files
session = GoogleSpreadsheet.login_with_oauth(@access_token)
begin
# @files = session.files
@ws = session.spreadsheet_by_key("<key>").worksheets[0]
rescue OAuth2::Error => err
logger.debug ("OAuth2::Error (#{err.inspect})" )
raise err
end
"https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email https://spreadsheets.google.com/feeds"}, @connection=#<Faraday::Connection:0x00000102d55040 @headers={}, @params={}, @options={}, @ssl={}, @parallel_manager=nil, @scheme="https", @host="accounts.google.com", @port=nil, @path_prefix="/o/oauth2/auth", @builder=#<Faraday::Builder:0x000001032f9dc0 @handlers=[Faraday::Request::UrlEncoded, Faraday::Adapter::NetHttp]>, @app=#<Faraday::Request::UrlEncoded:0x000001032f7570 @app=#<Faraday::Adapter::NetHttp:0x000001032f7598 @app=#<Proc:0x000001032f7778@/Users/eric/.rvm/gems/ruby-1.9.3-p0/gems/faraday-0.7.5/lib/faraday/connection.rb:78 (lambda)>>>>>, @token="ya29....", @refresh_token=nil, @expires_in=3600, @expires_at=1335745463, @options={:mode=>:header, :header_format=>"Bearer %s", :param_name=>"bearer_token"}, @params={"token_type"=>"Bearer", "id_token"=>"......."}>
access_token.request get, https://docs.google.com/feeds/default/private/full?v=3, {:header=>{}, :headers=>{"Authorization"=>"Bearer ..."}} and its: header with Bearer %s and ...
OAuth2::Error (#<OAuth2::Error: OAuth2::Error>)
Version 1.5 of Nokogiri isn't compatible witg google-spreadsheet-ruby:
Invalid expression: .//xmlns:link[@xmlns:@rel = 'http://schemas.google.com/spreadsheets/2006#cellsfeed'] (Nokogiri::XML::XPath::SyntaxError)
1.4.7 work fine.
Would you consider moving to nokogiri for the XML processing?
Now we can access worksheet cell using worksheet[2, 1].
It will be better if we can access it using worksheet[2,A]
Reason:
Might want to consider this switch. This is a half reminder to myself to write this patch :)
Currently the plugin does not seem to have a system handling invalid token errors. When the token is invalid (wrong scope, token revoked, etc.) we just have an exception related to a nil object (since the XML only contains the error message and the spreadsheet object cannot be filled wth values).
I'm thinking about implementing this functionnality in a fork.
I get 0.2.1 but there are a lot of changes missing, does the version number need to be bumped?
Hi,
I'm using google-spreadsheet-ruby with Ruby-on-Rails and Ruby 1.8, but overriding String.force_encoding in GoogleSpreadsheet breaks Rails.
In a few places Rails uses this method to determine whether Ruby 1.8 or 1.9 is being used, and if force_encoding is defined then rails assumes that Ruby 1.9 is being used. This is incorrect, which can then lead to rails crashing.
Can I suggest that instead of using String.force_encoding, instead you define a new method like this:
class String
def fake_force_encoding(encoding)
if RUBY_VERSION < "1.9.0"
return self
else
return force_encoding(encoding)
end
end
end
Then change all references to "String.force_encoding" to use "String.fake_force_encoding" instead. As by doing this force_encoding is not redefined and rails will function correctly.
Thanks!
I gem installed google-spreadsheet-ruby from gemcutter and I'm still missing the oauth gem; after installing it manually works perf
cannot load such file -- google_spreadsheet/file
Hello,
if I understand correct, there are google-doc spreadsheets which can be pulicly viewed or even edited. How can I access such a spreadsheet without the need to login with this gem?
-Thomas
Hi Guys,
In our application we would like to display a link after the Google Spreadsheet generation with the url of the spreadsheet. In order to get this url, we tried to use the function Spreadsheet::worksheets_feed_url generated by attr_reader(:worksheets_feed_url).
The problem is that this url leads to a 404 for a traditional gmail account and for a Google Apps Pro account. It seems to work almost fine however for a free a Google Apps account.
How shall we do to present to our end users the url of the generated document ?
We did the following as a work-around :
in Session::create_spreadsheet for instance,
after :
ss_url = doc.css(
"link[@rel='http://schemas.google.com/spreadsheets/2006#worksheetsfeed']").first['href']
We add :
ss_real_url = doc.css(
"link[@rel='alternate']").first['href']
and add this ss_real_url to the instance attributes of the Spreadsheet class.
Is it the right way to get this url ? If not could you give us some help ? If yes, would it be possible to add this to the plugin ?
Thanks for your help !
Olivier
Google Docs allows the share settings to be configured so that anyone with the link can edit that document. Is there a way to use this form of access with the gem?
Hello I am trying to use the google-spreadsheet gem with Authsub, is this possible at all?
thanks,
Joe
Seems to happen on when sending in characters with accents
Timeout::Error
./ruby/1.9.2/lib/ruby/1.9.1/net/protocol.rb:140:in rescue in rbuf_fill' ./ruby/1.9.2/lib/ruby/1.9.1/net/protocol.rb:134:in
rbuf_fill'
./ruby/1.9.2/lib/ruby/1.9.1/net/protocol.rb:116:in readuntil' ./ruby/1.9.2/lib/ruby/1.9.1/net/protocol.rb:126:in
readline'
./ruby/1.9.2/lib/ruby/1.9.1/net/http.rb:2219:in read_status_line' ./ruby/1.9.2/lib/ruby/1.9.1/net/http.rb:2208:in
read_new'
./ruby/1.9.2/lib/ruby/1.9.1/net/http.rb:1191:in transport_request' ./ruby/1.9.2/lib/ruby/1.9.1/net/http.rb:1177:in
request'
..../vendor/bundle/ruby/1.9.1/gems/rest-client-1.6.7/lib/restclient/net_http_ext.rb:51:in request' ./ruby/1.9.2/lib/ruby/1.9.1/net/http.rb:978:in
post'
…./vendor/bundle/ruby/1.9.1/gems/google-spreadsheet-ruby-0.1.6/lib/google_spreadsheet.rb:189:in block in request_raw' ./ruby/1.9.2/lib/ruby/1.9.1/net/http.rb:627:in
start'
…./vendor/bundle/ruby/1.9.1/gems/google-spreadsheet-ruby-0.1.6/lib/google_spreadsheet.rb:183:in request_raw' …./vendor/bundle/ruby/1.9.1/gems/google-spreadsheet-ruby-0.1.6/lib/google_spreadsheet.rb:433:in
request'
…./vendor/bundle/ruby/1.9.1/gems/google-spreadsheet-ruby-0.1.6/lib/google_spreadsheet.rb:1024:in block in save' …./vendor/bundle/ruby/1.9.1/gems/google-spreadsheet-ruby-0.1.6/lib/google_spreadsheet.rb:995:in
each_slice'
…./vendor/bundle/ruby/1.9.1/gems/google-spreadsheet-ruby-0.1.6/lib/google_spreadsheet.rb:995:in `save'
We really like your gem and would like to use it, but need to know what license it is under. Ideally there would be a license file at the project root and an entry in the gemspec (http://docs.rubygems.org/read/chapter/20#license).
Does the library support changing the ACL / permissions of a spreadsheet? I don't see any functionality for doing so.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.