Skip to content

Instantly share code, notes, and snippets.

@Snarp
Created May 22, 2020 21:24
Show Gist options
  • Save Snarp/02c8b1ba7378b864499ccd4159ece0a1 to your computer and use it in GitHub Desktop.
Save Snarp/02c8b1ba7378b864499ccd4159ece0a1 to your computer and use it in GitHub Desktop.
Download Google Doc as HTML (or one of various other formats)
require 'faraday'
# Valid formats: html, doc, docx, epub, odt, pdf, txt
def get_doc_as(doc_id, type='html')
Faraday.get("https://docs.google.com/document/d/#{doc_id}/export?format=#{type}").body
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment