Trigger Function

Please guys I need some help.
I am new here. I have created a COVID 19 Tracker app
https://letstrackcorona.glideapp.io/.
I have to edit it everyday, please can anyone tell me about trigger function so that my sheet is updated automatically after some hours.

What functions do you have in your sheet?

1 Like

IMPORTHTML is the function I have used.

According to Google’s official support, IMPORTHTML recalculates every 1 hour.

Functions that pull data from outside the spreadsheet recalculate at the following times:

  • ImportRange: 30 minutes
  • ImportHtml, ImportFeed, ImportData, ImportXml: 1 hour
  • GoogleFinance: may be delayed up to 20 minutes

Reference: https://support.google.com/docs/answer/58515?hl=en

If you want a script to trigger it, the script here might be fine.

1 Like

In my case, it does not update, please help. It does not refersh automatically. I am a beginner so please tell should I paste the code in google script? Thanks in advance

Does it recalculate when you open the Sheets?

1 Like

That would be my question too. Is it the sheet not updating or the app not updating? Free apps will only pull updates from ImportHTML if you are potentially making data changes through the app to cause it to sync, or you upgrade to Pro and turn on Background Refresh. Google will not send ImportHTML updates to Glide automatically.

3 Likes

No, not at all

Does it recalculate if you delete the content of the cell and undo that action immediately?

1 Like

Yeah that is a major problem for me. As it is covid 19 tracker app, I need to again do IMPORTHTTML daily so as to update the tables

When I delete the URL and again paste it there, then the table updates or recalculates.

of course @Khushi_Puri, you need a script!

Use what I use on my Covid-19 APP too, it works fine:

function Actualizar() {
 // Se ejecuta cada 1 hora  (it's fired each hour)
 var sheetName = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(" YOUR_TAB "); 
 var queryString = Math.random(); 
 var cellFunction = '=IMPORTHTML(" YOUR_LINK "; "table";1 )'; 
 sheetName.getRange('A1').setValue(cellFunction); 
  }

The function Math.random() is to create a new value in spreadsheet and avoid to use/retrieve data from cache memory in every execution.

Don´t forget to create the script’s Trigger based on Time (1 hour) of course! :woozy_face:

Saludos!

3 Likes

Thank you so much :relaxed: :innocent:
I’ll definitely try this out today and inform you.
Have a good day