user3399002
user3399002

Reputation: 1

Google Script, Import HTML data

I'm trying to create a personal notifier whenever a certain website contains the word 'Indian' the script should email me. For some reason I cannot find a script function that would import HTML data,

Is there such a function?

Upvotes: 0

Views: 6718

Answers (2)

user20472970
user20472970

Reputation:

Just like Harold said, you can perform a URL fetch:

var output = UrlFetchApp.fetch("https://raw.githubusercontent.com/####");
var form = HtmlService.createHtmlOutput(output.getContentText());
SpreadsheetApp.getUI().showModalDialog(form, "Fetched HTML");

You can otherwise fetch a website using the same tactic, for example:

var output = UrlFetchApp.fetch("https://www.google.com");
var form = HtmlService.createHtmlOutput(output.getContentText());
SpreadsheetApp.getUI().showModalDialog(form, "Fetched HTML");

Upon launch, the dialog should return Google's homepage.

Upvotes: 0

Related Questions