1

I need update a row with function =importxml() every 3 minutes to refresh MAP gadget.

I setup function redROWs trigger to every 3 minutes but it doesn't work. Any idea?

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
POLLOX
  • 302
  • 1
  • 4
  • 17
  • can you post some code & more details of what you have done. But not sure you will be able to do every 3 mins, there are limits on trigger run time. – eddyparkinson Apr 19 '13 at 08:23
  • I´m runing this default Every minute from from the trigger wizard. function function readRows() { var sheet = SpreadsheetApp.getActiveSheet(); var rows = sheet.getDataRange(); var numRows = rows.getNumRows(); var values = rows.getValues(); for (var i = 0; i <= numRows - 1; i++) { var row = values[i]; Logger.log(row); } }; – POLLOX Apr 19 '13 at 08:24

2 Answers2

4

The importXML() is updating every 2 hours by it self and you can't trigger it from a script. Then you have to write the function into your script..

The best solution I found is to add the GoogleClock() to the URL. It makes the ImportXML update every minute automatically. Also when the spreadsheet is not open.

Like this: ImportXML("URL"&GoogleClock(),"div...")

BrnKd
  • 49
  • 1
  • 3
  • 4
    Note: this is "old sheets" behaviour, the new Sheets offering (as of 2014) no longer acts like this, and does not support `GoogleClock()` either. – Mogsdad Nov 23 '15 at 15:09
1

getActiveSheet() only works when you have the spreadsheet open - use openById

https://developers.google.com/apps-script/reference/spreadsheet/spreadsheet-app#openById(String)

to trigger =importxml , write something to the sheet.

eddyparkinson
  • 3,680
  • 4
  • 26
  • 52