Search code examples
google-docs-api

Programmatically download a Google Doc?


Google Docs have a "Download as..." menu option, with several choices of format such as PDF, text, etc.

How can I programmatically download a particular Google document?


Solution

  • From how to programmatically download a public Google Drive file?:

    You don't need any Google SDK if you know the link and the file is public. Just use a standard HTTP GET method to download the file.

    Example with AngularJS:

    $http.get('/doc_url').
      then(function(response) {
        // this callback will be called asynchronously
        // when the response is available
      }, function(response) {
        // called asynchronously if an error occurs
        // or server returns response with an error status.
      });