Comments (8)
download_to_file uses different API, and it seems it only supports downloading as HTML.
To download as PDF, you need to write code to fetch the URL you mentioned manually. You can probably use session.request() method to reuse the authorization google-drive-ruby provides.
It would be nice to have that feature in google-drive-ruby. But the API google-drive-ruby uses (Document List API) will be deprecated, so I need to switch to Google Drive API. So I will implement that feature after the switch (if it's available in Google Drive API).
from google-drive-ruby.
I don't understand why this issue is closed when it still remains. It looks like it is solved, I suggest to keep it open so is noticed there is still someone working on it.
from google-drive-ruby.
This issue is not closed.
from google-drive-ruby.
You're right, my fault, I was seeing the "Closed" tag in the comments making reference to duplicate issues and I was confused, sorry.
from google-drive-ruby.
Please, can someone provide a working example of a workaround for this custom export?
I'm trying but I'm not able to be success. For example, this document has public access:
Following this url you can download it:
If I try to do it using session.request()
I obtain an empty Nokogiri::XML::Document
:
r = session.request(:get, "https://docs.google.com/feeds/download/documents/export/Export?id=12nB8pHtphQ_OaluOQdgMub9M1XFCSpiIbW4p7o53nm8&exportFormat=txt")
r.inspect
=> "#<Nokogiri::XML::Document:0x3fff1a04b8a8 name=\"document\">"
And I don't know how to actually get the content of the file
from google-drive-ruby.
You need no pass another parameter, look at #64 .
from google-drive-ruby.
Thanks @simontesar it works:
r = session.request(:get, "https://docs.google.com/feeds/download/documents/export/Export?id=12nB8pHtphQ_OaluOQdgMub9M1XFCSpiIbW4p7o53nm8&exportFormat=txt", :response_type => :raw)
puts r # => Hello
from google-drive-ruby.
It was fixed in google_drive 1.0.0. I confirmed that Google Document -> .pdf and .docx works. You need to use export_as_file method.
from google-drive-ruby.
Related Issues (20)
- Dependabot can't resolve your Ruby dependency files
- Dependabot can't resolve your Ruby dependency files
- Dependabot can't resolve your Ruby dependency files
- Dependabot can't resolve your Ruby dependency files
- Dependabot can't resolve your Ruby dependency files
- Can list files but not read them HOT 5
- Incompatible dependencies with 3.0.7 HOT 1
- How to download file infected with virus?
- Support shortcut files
- How can i get a file by id HOT 2
- Warning: `Unknown key: SameSite = none`
- support googleauth gem 1.0? HOT 1
- Deprecated OAuth out-of-band (oob) flow HOT 3
- App blocked
- How can I obtain the hyperlink of a cell
- Google Oauth out-of-band (OOB) Flow Deprecated Oct 3 HOT 12
- SSL Error while accessing the GoogleDrive API HOT 2
- [ASK] Is there a way to set Folder permission HOT 1
- Breaks console, multiple issues.
- Runtime dependency / googleauth ~> 1.0 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from google-drive-ruby.