Skip to content

Latest commit

 

History

History
68 lines (26 loc) · 1.63 KB

File metadata and controls

68 lines (26 loc) · 1.63 KB

gas-node-html-parser

app script html parser for data extraction, google apps script html parser for web scraping, node html parser for google apps script projects , html parsing tool for google apps script server-side scripting, robust html parser for app script data manipulation, efficient html parser for google apps script integration

gas-node-html-parser is a build of the popular Node.js module node-html-parser, specifically adapted for the Google Apps Script environment. It provides robust and efficient HTML parsing capabilities that are ideal for server-side scripting, allowing you to easily extract, manipulate, and analyze HTML data directly within your GAS projects. Whether you need to perform web scraping, data extraction, or dynamic content manipulation, this tool serves as the perfect "app script html parser" for your needs

GAS Library ID: 17hRy4vFVAND6qwEjHLQG5CwYpwNGvlloydh7zgRG2bWhqB1_nCIQQo7B

Usage

Example 1

function  parseHtmlExample() {

var  htmlText = UrlFetchApp.fetch("http://exmple.com/").getContentText();

var  document = NodeHtmlParser.parse(htmlText);

var  titleElement = document.querySelector("title")

var  title = titleElement.innerText;

Logger.log(title);

}

Example 2:

function  parseHtmlExample() {

var  htmlContent = '<html><body><h1>Hello, GAS!</h1></body></html>';

var  root = NodeHtmlParser.parse(htmlContent);

  

// Use the root element to find elements, for example, the first <h1>:

var  h1Element = root.querySelector('h1');

// Log the text content of the <h1> element

Logger.log(h1Element.innerText);

}