I'm trying to import a shared (to everyone) Google spreadsheet into my database in Rails, using Roo. The following code:
url = 'https://docs.google.com/spreadsheets/d/1-4kCLEXRcIlJB1wK5muZWsIL1nz5NsEWXyLrbe_HJNQ/edit?usp=sharing'
xls = Roo::Spreadsheet.open(url)
gives me
undefined method `spreadsheet_by_key' for nil:NilClass" error message.
Could you suggest what am I doing wrong? What is the easiest way to import a shared Google spreadsheet in Rails?
Yes, worked like a charm:
url = 'https://docs.google.com/spreadsheets/d/MY_FILE_ID/export?format=xlsx'
xls = Roo::Spreadsheet.open(url, extension: :xlsx)
You were quite right about the "extension" option, it would not work without it.
Thank you a lot!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With