cheeriogs
Cheerio/ jQuery for Google Apps Script
AI Summary
cheeriogs (cheerio for Google Apps Script)
A library that enables cheerio on Google Apps Script, allowing jQuery-like HTML parsing and manipulation.
Target Users
Intermediate Google Apps Script developers building internal tools or scrapers who need to automate web data extraction.
Problems Solved
Apps Script lacks browser DOM APIs, making it difficult to parse and manipulate complex HTML efficiently.
Tags
Main Features
jQuery-like API
cheeriogs exposes cheerio.load unmodified, enabling $('selector') style element queries and text extraction; familiar DOM operations become possible inside Apps Script.
Up-to-date Cheerio 1.0
Bundles official cheerio 1.0.0 so the newest selector features and fixes are available within Apps Script.
Easy library import
Start using it by adding the script ID in the “Libraries…” dialog—no bundling or external hosting required.
Usage Examples
Get text from a specific element on a web page
/**
* Sample that logs the text of the right column on Wikipedia's main page.
*/
function sampleCheerioScrape() {
// 1. Fetch the page
const url = 'https://en.wikipedia.org';
const html = UrlFetchApp.fetch(url).getContentText();
// 2. Load it with Cheerio
const $ = Cheerio.load(html);
// 3. Use a selector to extract text
const rightColumnText = $('#mp-right').text();
// 4. Output the result
Logger.log(rightColumnText);
}
Copy the snippet into your Apps Script project and run sampleCheerioScrape()
; the text from Wikipedia's right column will appear in the execution log.