Google-sheets – In Google Spreadsheet run a function from cell programmatically

google sheetsgoogle-apps-scriptgoogle-sheets-custom-function

I made an Apps Script custom function in a Google spreadsheet.

I can call it from a cell and works fine (In Google Script, get the spreadsheet cell calling a custom function).

The function makes an API call to retrieve some information from the web. The data changes constantly, so I'd like to execute the function programmatically. I tried using triggers, but the only options I get when choosing the source "from a spreadsheet" are "when open", "when close" or "when change". Then, there is another source for choosing a programmatically call, but executes the function itself, not the one I call from the cell.

I want the value of the cell to be updated each XX seconds (a period of time).

NOTE: My function fetches a value from a free Web API, so I need it to fetch it using an interval of time, let's say every 5 seconds

Best Answer

In your comment you mention about an: "...interval of time, let's say every 5 seconds"

This is not possible.

Please check the Quotas for Google Services for further info.

Triggers total runtime  | 90 min / day  | 6 hr / day