title: how to download or read content from google drive files using service account
body: <p>I am able to list all <strong>files/docs</strong> from the google drive using a service account with the <strong>access token</strong>. <strong>REST API</strong>. <strong>Python</strong> script
  and I am not able to download/read content from documents. its throwing error like below. </p>
  
  <pre><code>https://www.googleapis.com/drive/v2/files/1LWkJmHqv7lHfdd6qLq8ssdJ99BYeP-9axC
  </code></pre>
  
  <p>Getting file data API URL</p>
  
  <pre><code>{
  "kind": "drive#file",
  "id": "1LWkJmHqv7lHfdd6qLq8ssdJ99BYeP-9axC",
  "etag": "\"MTU4NzI4MTM3MzQ2Ng\"",
  "selfLink": "https://www.googleapis.com/drive/v2/files/1LWkJmHqv7lHfdd6qLq8ssdJ99BYeP-9axC",
  "webContentLink": "https://drive.google.com/a/dummywebsite.com/uc?id=1LWkJmHqv7lHfdd6qLq8ssdJ99BYeP-9axC&amp;export=download",
  "alternateLink": "https://drive.google.com/a/dummywebsite.com/file/d/1LWkJmHqv7lHfdd6qLq8ssdJ99BYeP-9axC/view?usp=drivesdk",
  "embedLink": "https://drive.google.com/a/dummywebsite.com/file/d/1LWkJmHqv7lHfdd6qLq8ssdJ99BYeP-9axC/preview?usp=drivesdk",
  "iconLink": "https://drive-thirdparty.googleusercontent.com/16/type/text/plain",
  "thumbnailLink": "https://lh3.googleusercontent.com/ydrbZst2W6we3faCPlnYYKluglSTNprdrhEbJjueA5lRgjsqG8FN-Xp0Zqyy68H_XOTEWi2yQlU=s220",
  "title": "hello.txt",
  "mimeType": "text/plain",
  "labels": {
      "starred": false,
      "hidden": false,
      "trashed": false,
      "restricted": false,
      "viewed": true
  },
  "copyRequiresWriterPermission": false,
  "createdDate": "2020-04-17T20:34:32.643Z",
  "modifiedDate": "2020-04-19T07:29:33.466Z",
  "modifiedByMeDate": "2020-04-17T20:34:30.000Z",
  "lastViewedByMeDate": "2020-04-18T20:09:44.394Z",
  "markedViewedByMeDate": "1970-01-01T00:00:00.000Z",
  "version": "5",
  "parents": [
      {
          "kind": "drive#parentReference",
          "id": "1ccTLIrnwkbTZxUoUavCIwCmz5c68Rymi",
          "selfLink": "https://www.googleapis.com/drive/v2/files/1LWkJmHqv7lHfdd6qLq8ssdJ99BYeP-9axC/parents/1ccTLIrnwkbTZxUoUavCIwCmz5c68Rymi",
          "parentLink": "https://www.googleapis.com/drive/v2/files/1ccTLIrnwkbTZxUoUavCIwCmz5c68Rymi",
          "isRoot": false
      }
  ],
  "downloadUrl": "https://www.googleapis.com/drive/v2/files/1LWkJmHqv7lHfdd6qLq8ssdJ99BYeP-9axC?alt=media&amp;source=downloadUrl",
  "userPermission": {
      "kind": "drive#permission",
      "etag": "\"Oui67PMpWNMX2al1jEJ17kn5eZg\"",
      "id": "me",
      "selfLink": "https://www.googleapis.com/drive/v2/files/1LWkJmHqv7lHfdd6qLq8ssdJ99BYeP-9axC/permissions/me",
      "role": "owner",
      "type": "user"
  },
  "originalFilename": "hello.txt",
  "fileExtension": "txt",
  "md5Checksum": "8ed250d6af95636c70b3ed064260246e",
  "fileSize": "4",
  "quotaBytesUsed": "4",
  "ownerNames": [
      "Balasubramanian V"
  ],
  "owners": [
      {
          "kind": "drive#user",
          "displayName": "Balasubramanian V",
          "picture": {
              "url": "https://lh3.googleusercontent.com/a-/AOh14GiIt3jyOQ6VYF0XK_RjwnFTihxnXHOTzzRlaXlRrETHSP79k3XpKMVpX5ZctbtDdThSt_8cxbr2TKWf-BkHe7DzzIyYD4Pz0Et8G_lPv0t7Vk63-sh_JSAZIh6OJbUqzvNh3721AEhxd3wqVMAZT1ux8QIbsMaOrHaSLqGut1XTmqbKUyhfUiLRKUZWTtEb3ZFsggG5G6T-zyxITU65HuXZX5f5pQwoKSf8hyRHIeJBR04ofxltrV6v5jRteBaHUB8ZS6MUe_Gw1Lar4hVTNW5Cy5vAu-b9elgLSvtqNLC9RGP_U0ILlBemgj72rtz2WBzPoeoiRZum_2uASihttAISspHq1L4Ks5L_KFZ2O80YPZ4mfVdywn1L4jlQf0uAXIEhe2jlEjyPf1eQ2LrsrA1ApkxgXkwNSHPvjU4fUcXNpefucf9TrNIX8VRbu4DPHKT8C3EdqpFx5dQLh-m7EvJE1H0TTZ5nY6mhHfFebeC14W22uk95Tg953y9M1PDiYyIC-hlcNLUWSeOx3CBzCMGAAaUfQqO5fyvOU-3gAENPO1qdPnurPdEsuH5csDx6tuyMZSHcGOPTR_5FHp6rcQ-gjtahI0pHqB27Bt0aeg7JuTG4vSA7v7ru6DK6Rb73jP0rEoDztNW72K-CqtpLjM4kGn30ZhaLM8qHNbiD_zGjZT5_8oldj6ad4eKn_DrQuC51vDEIzyrYwkEf_E9wBR7rlVUiWIqsFHBALIyw9z_aW3122BAdePAvotGQ3vlrGjRXTw=s64"
          },
          "isAuthenticatedUser": true,
          "permissionId": "02978886251107598035",
          "emailAddress": "info@dummywebsite.com"
      }
  ],
  "lastModifyingUserName": "Balasubramanian V",
  "lastModifyingUser": {
      "kind": "drive#user",
      "displayName": "Balasubramanian V",
      "picture": {
          "url": "https://lh3.googleusercontent.com/a-/AOh14GiIt3jyOQ6VYF0XK_RjwnFTihxnXHOTzzRlaXlRrETHSP79k3XpKMVpX5ZctbtDdThSt_8cxbr2TKWf-BkHe7DzzIyYD4Pz0Et8G_lPv0t7Vk63-sh_JSAZIh6OJbUqzvNh3721AEhxd3wqVMAZT1ux8QIbsMaOrHaSLqGut1XTmqbKUyhfUiLRKUZWTtEb3ZFsggG5G6T-zyxITU65HuXZX5f5pQwoKSf8hyRHIeJBR04ofxltrV6v5jRteBaHUB8ZS6MUe_Gw1Lar4hVTNW5Cy5vAu-b9elgLSvtqNLC9RGP_U0ILlBemgj72rtz2WBzPoeoiRZum_2uASihttAISspHq1L4Ks5L_KFZ2O80YPZ4mfVdywn1L4jlQf0uAXIEhe2jlEjyPf1eQ2LrsrA1ApkxgXkwNSHPvjU4fUcXNpefucf9TrNIX8VRbu4DPHKT8C3EdqpFx5dQLh-m7EvJE1H0TTZ5nY6mhHfFebeC14W22uk95Tg953y9M1PDiYyIC-hlcNLUWSeOx3CBzCMGAAaUfQqO5fyvOU-3gAENPO1qdPnurPdEsuH5csDx6tuyMZSHcGOPTR_5FHp6rcQ-gjtahI0pHqB27Bt0aeg7JuTG4vSA7v7ru6DK6Rb73jP0rEoDztNW72K-CqtpLjM4kGn30ZhaLM8qHNbiD_zGjZT5_8oldj6ad4eKn_DrQuC51vDEIzyrYwkEf_E9wBR7rlVUiWIqsFHBALIyw9z_aW3122BAdePAvotGQ3vlrGjRXTw=s64"
      },
      "isAuthenticatedUser": true,
      "permissionId": "02978886251107598035",
      "emailAddress": "info@dummywebsite.com"
  },
  "capabilities": {
      "canCopy": true,
      "canEdit": true
  },
  "editable": true,
  "copyable": true,
  "writersCanShare": true,
  "shared": true,
  "explicitlyTrashed": false,
  "appDataContents": false,
  "headRevisionId": "0B_QZJ9jWm1W-OXZCZEpkOG1HT2Q4alBrWmRPdDI4aXNQWnI4PQ",
  "spaces": [
      "drive"
  ]
  </code></pre>
  
  <p>}</p>
  
  <p>API URL:     <code>https://www.googleapis.com/drive/v3/files/1LWkJmHqv7lHfdd6qLq8ssdJ99BYeP-9axC/export?mimeType=text/plain</code> </p>
  
  <pre><code>{
      "error": {
          "errors": [
              {
                  "domain": "global",
                  "reason": "fileNotExportable",
                  "message": "Export only supports Google Docs."
              }
          ],
          "code": 403,
          "message": "Export only supports Google Docs."
      } }
  </code></pre>
  
  <p>I don't want to download documents through browser auth. I need it through the server-side automatic download and reading process.</p>
  
  <p>All the online guides are giving web download options only.</p>
  
  <p>Please help me.</p>