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
The only way to fetch a value and add it to a Google Sheets cell every few seconds from a Web API by using Google Apps Script is using client side code to call a server side function. One way to do this is by using a sidebar and setInterval to execute google.script.run periodically.
This will work while the user account doesn't exceed the Google Apps Script ...