Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ranaroussi/d7b2083674ddfc60e055fd10ba84f08b to your computer and use it in GitHub Desktop.
Save ranaroussi/d7b2083674ddfc60e055fd10ba84f08b to your computer and use it in GitHub Desktop.
SHEET_NAME="Sheet1"
URL="https://data.sparkfun.com/output/VFEEYZENwLCNwE8LZjDA.csv"

function myFunction() {
  ScriptApp.newTrigger("getData")
  .timeBased()
  .everyMinutes(1)
  .create();
}

function getData() {
  SpreadsheetApp
  .getActiveSpreadsheet()
  .getSheetByName(SHEET_NAME)
  .getRange("a1")
  .setValue("=IMPORTDATA(\"" + URL + "?" + Utilities.formatDate(new Date(), "GMT", "yyyyMMddHHmmss") + "\")");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment