3

I have a thread containing an infinite loop that should always be looking at the most recent version of a Google Sheet.

How much to recreate each iteration to ensure that my reference to it is updated?

  • The NetHttpTransport?
  • The Sheets object?
  • The Sheets#spreadsheets call?
  • The Sheets.Spreadsheet#values call?
  • Nothing, all parts of the API are always up-to-date?

I wasn't able to find anything in Javadoc.

Ori Marko
  • 56,308
  • 23
  • 131
  • 233
AAM111
  • 1,178
  • 3
  • 19
  • 39
  • Nothing, all parts of the API are always up-to-date. – TheMaster Oct 30 '18 at 21:37
  • @TheMaster Thanks! Would you like to write an answer? And do you have a source from Google's documentation/your own experience? – AAM111 Oct 31 '18 at 19:05
  • Java is outside my scope. The first 4 paragraphs [here](https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/batchUpdate) explains how requests are applied atomically. But, I cannot test it with Java. If you have, Please add it as a answer. – TheMaster Oct 31 '18 at 20:28
  • 1
    That page is about the client updating spreadsheets, but I'm asking about other users updating spreadsheets and the client making sure its reference is up to date. – AAM111 Nov 01 '18 at 17:55
  • I still think the answer is the same. The API(just like the spreadsheet itself) is live and doesn't lag behind manual user changes, unless of course, the user is offline and changes are yet to be committed to Google servers. Once committed, all programmatic accesses(API/Apps script) are live. But, I've got no documentation. – TheMaster Nov 01 '18 at 19:14

1 Answers1

3

There's a usage limit which is ~ 1 request per second per user:

This version of the Google Sheets API has a limit of 500 requests per 100 seconds per project, and 100 requests per 100 seconds per user. Limits for reads and writes are tracked separately. There is no daily usage limit.

As @TheMaster comment, API should be ~ always up-to-date,

You may use also Apps Script triggers:

you can only do it with the help of Apps Script. You can use a trigger here to detect if something is change in your spreadsheet.

Ori Marko
  • 56,308
  • 23
  • 131
  • 233