-
-
Save landsurveyorsunited/c7b7ebfce6b89e621fa5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getImportio() { | |
var url = "YOUR_IMPORTHTML_URL"; | |
/* | |
* Class UrlFetchApp | |
* | |
* Fetch resources and communicate with other hosts over the Internet. This service allows | |
* scripts to communicate with other applications or access other resources on the web by | |
* fetching URLs. A script can use the URL Fetch service to issue HTTP and HTTPS requests | |
* and receive responses. The URL Fetch service uses Google's network infrastructure for | |
* efficiency and scaling purposes. | |
* | |
* https://developers.google.com/apps-script/reference/url-fetch/url-fetch-app | |
* | |
* UrlFetchApp.fetch(url) | |
* | |
* @param {string} url String the URL to fetch | |
* @return {object} HTTPResponse — the HTTP response data | |
*/ | |
var resp = UrlFetchApp.fetch(url); // fetches the http response from the import.io API | |
// the response object includes headers, response code and content we are getting the | |
// content which in this case is a html table | |
var table = resp.getContentText(); | |
/* | |
* Class MailApp | |
* | |
* Sends email. | |
* This service allows users to send emails with complete control over the content of the | |
* email. Unlike GmailApp, MailApp's sole purpose is sending email. MailApp cannot access | |
* a user's Gmail inbox. | |
* | |
* https://developers.google.com/apps-script/reference/mail/mail-app | |
* | |
* MailApp.sendEmail(recipient, subject, body, options) | |
* | |
* @param {string} recipient String the addresses of the recipients, separated by commas | |
* @param {string} subject String the subject line | |
* @param {string} body String the body of the email | |
* @param {onject} options Object a JavaScript object that specifies advanced parameters, | |
* - in this example we are including htmlBody String if set, devices capable of rendering | |
* - HTML will use it instead of the required body argument; you can add an optional inlineImages | |
* - field in HTML body if you have inlined images for your email | |
* | |
*/ | |
MailApp.sendEmail("recipient_addresss@example.com", "Latest from import.io", "", {htmlBody:table}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment