2

We use the Google Drive SDK to monitor a folder of spreadsheets for changes. When a change happens, we download the file to our servers and convert it to JSON for further use.

Since a file may contain multiple sheets, we go through this process to extract all sheets:

  1. Download the embedLink from the drive#file resource and parse the HTML to extract the gid of each sheet. (Similar to the approach used here.)
  2. Download each individual sheet as CSV by appending ?gid=... to the text/csv URL from the exportLinks field.

Recently we've been seeing 429 Too Many Requests errors, especially if the file gets big enough. According to the API console we're not close to the quota limit, so presumably export links are not counted as API requests, but is rate limited some other way. Exporting the sheet manually – as a different user from the one used against the Drive API – works fine.

Is there a way to find the gid of each sheet in a file without downloading the full embedHTML? If not, is there some way to avoid hitting the download limit?

EDIT: This incorrectly closed issue seems to deal with the problem of finding the gids of a spreadsheet file.

UPDATE: I've worked around this issue by parsing the XLSX export instead of the CSVs. Haven't seen the problem since.

jarib
  • 6,028
  • 1
  • 24
  • 27
  • 1
    We have the same issue. The 429 error just suddenly came around at some point at early March. We have to add exponential backoff retry to download. It is really annoying since it only took 5-6 seconds to download about 100 CSV file before and now it took 6-8 minutes. Have you made any progress on this? – Felix May 20 '16 at 11:21
  • I've worked around it by parsing the XLSX export instead. – jarib May 22 '16 at 07:27

1 Answers1

0

I am a little late to the party, but this is for future readers.

Refer to this answer to know why the behavior @felix mentioned is happening.

I am quoting @chrish from the comments.

WARNING: Web hosting support in Google Drive is deprecated. "Beginning August 31, 2015, web hosting in Google Drive for users and developers will be deprecated. Google Apps customers can continue to use this feature for a period of one year until August 31, 2016, when serving content via googledrive.com/host/doc id will be discontinued."

Also, to know more details on the subject, you can read the article Deprecating web hosting support in Google Drive by Google.

Hope it helps.