Open andymeneely opened 9 years ago
I would love this! Im building our game with a team and we're using google sheets, I've been having to periodically download the sheets into csv and copy them to the project. This would be a great addition.
Thanks for the vote!
I should also point out that we had someone write up a workaround for now: http://andymeneely.github.io/squib/doc/file.README.html#Using_Google_Sheets
Let me know if it doesn't work, though. Google keeps changing its apis.
Love the idea. I use sheets for all of my development now.
It's not looking good for Ruby+Google these days. Google has changed their API and usage rules a lot lately, and I haven't seen any Ruby gems make a concerted effort to keep up.
Google also now requires things like API keys and OAuth, which complicates the process much more than most Squibbers have the stomach for.
But if someone else wants to take that on, it doesn't have to integrate with Squib at all - it could just be a general exporter. I would love to be proven wrong.
perhaps a good time to revisit this issue? https://developers.google.com/sheets/api/quickstart/ruby
there's also this gem http://www.rubydoc.info/gems/google_drive/GoogleDrive/Spreadsheet
But basically all one needs is a in ruby way of downloading a .csv from google sheet
Yeah that google_drive gem is the one I was using a while back. I'm glad to see it's back to being regularly updated now.
Honestly, while I know folks would love to have this built into Squib, I'm not quite ready to support it. The OAuth steps, while simple for some folks, can be a little daunting for some and I'm not ready to put the support effort into that.
If someone wants to make this happen, it's easy enough to define your own method that works a lot like the Excel parser. You can always post that as a Gist or on this issue. Or, better yet, you can maintain your own gem called squib_google
or something.
If that code gets used a lot and maintaining is easy, then I'd be willing to put it into Squib.
You can use Publish to the web...
functionality in Google Sheets to make an url that returns CSV.
In Google Sheets:
That link is now something you can curl
or directly import from Ruby. Note that it doesn't re-publish immediately, it can take up to a minute or two, so it's not great for rapid iteration. It's usually pretty fast though.
Here's how you'd do it in Squib:
require 'net/http'
uri = URI("https://docs.google.com/spreadsheets/d/e/YOUR_GOOGLE_LINK/pub?gid=0&single=true&output=csv")
data = Squib.csv data: Net::HTTP.get(uri)
It's what I'm using and it works great.
Just say NO to Google APIs!
Much like
xlsx
andcsv
, maybe a method to get data from Google Sheets?Pros:
Cons:
Thoughts? Post your votes here!