- Creare un foglio di Google Spreadsheet
- cliccare su Strumenti
- editor di Script
- crea nuovo
Scrivere quanto segue :
function getData() { var queryString = Math.random(); var cellFunction = '=IMPORTHTML("http://www.xxxxx.it//?' + queryString + '";"table";1)'; SpreadsheetApp.getActiveSheet().getRange('A1').setValue(cellFunction); }
La funzione IMPORTHTML indica da che fonte vogliamo importare i dati che provengono da un sito web.
Il numero dopo table è il numero della tabella che si vuole recuperare.
La cella indicata da getRange(‘A1’) indica la cella in cui vogliamo che i dati importati siano scritti
Poi occorre creare un trigger nel seguente modo :
Step 2: Set up a Trigger
- From inside the Script Editor, click on the Resources menu and select the option Current project’s triggers
- In the window that appears, click the link No triggers set up. Click here to add one now.
- This will create a trigger for your function. Change the default Hour timer to Minutes timer.
- Click Save
Al termine salvare, poi andare su File, Impostazioni foglio di lavoro, ed impostare nella sezione RICALCOLO ogni quanto vogliamo che Google aggiorni il foglio con i dati importati.
0 commenti