1.70 ๐ Parse XML RSS Feeds with Google Scripts
Use UrlFetchApp to fetch RSS feeds and XmlService to parse them:
var xml = UrlFetchApp.fetch("https://example.com/rss").getContentText();
var document = XmlService.parse(xml);
var items = document.getRootElement().getChild("channel").getChildren("item");
Loop through items to extract title, link, and pubDate.
1.71 ๐งช Copy Google Spreadsheet Data to another Sheet with Apps Script
Use getRange().getValues() from source and setValues() on target sheet:
let data = sourceSheet.getRange("A1:D20").getValues();
targetSheet.getRange(1, 1, data.length, data[0].length).setValues(data);
1.72 ๐ A Custom Google Spreadsheet Function for Tracking Pageviews
Create a custom function using Analytics API or third-party counters:
function PAGEVIEWS(url) {
const response = UrlFetchApp.fetch("https://api.analytics.com/viewcount?url=" + url);
return JSON.parse(response).views;
}
Display total pageviews inline in your Google Sheet.
1.73 ๐งช Save Google Sheet as JSON
Use Apps Script to convert sheet data to JSON and export it:
const data = sheet.getDataRange().getValues();
const headers = data.shift();
const json = data.map(row => Object.fromEntries(row.map((v, i) => [headers[i], v])));
Then save it to Drive or serve via doGet().
1.74 ๐ Publish Google Spreadsheets as JSON with Apps Script
Create a web app with doGet(e) returning ContentService.createTextOutput(JSON.stringify(...)).
Share your spreadsheet publicly or make it accessible via script to serve structured JSON directly from your Sheet.
1.75 ๐งช Find Matching Rows in Google Spreadsheets
Use a formula:
=IF(COUNTIFS(A:A, A2, B:B, B2) > 1, "Duplicate", "Unique")
Or use Apps Script to compare row-by-row and push matches to another sheet or highlight them with formatting.
1.76 ๐ Export your Fitbit Data in a Google Spreadsheet
Use the Fitbit Web API with OAuth token via Apps Script:
const response = UrlFetchApp.fetch("https://api.fitbit.com/1/user/-/activities/date/today.json", {headers: {"Authorization": "Bearer YOUR_TOKEN"}});
Extract steps, heart rate, and sleep data into your spreadsheet.
1.77 ๐งช Get QuickBooks Data into Google Sheets with Apps Script
Use QuickBooks Online API and OAuth2 authentication. Fetch invoices, payments, or customer records:
UrlFetchApp.fetch("https://quickbooks.api.intuit.com/v3/company/{companyId}/query?...", headers)
Parse JSON data and insert rows programmatically.
1.78 ๐ Merge Multiple Google Spreadsheets into One
Use SpreadsheetApp.openById() to access multiple sheets and merge them:
let files = DriveApp.getFilesByType(MimeType.GOOGLE_SHEETS);
while (files.hasNext()) { ... }
Loop through and copy ranges from each into a master sheet.
1.79 ๐งช Get Email Notifications for Edits in Google Spreadsheet
Set up an installable onEdit(e) trigger and use MailApp.sendEmail():
function onEdit(e) {
MailApp.sendEmail("[email protected]", "Sheet Edited", "Cell edited: " + e.range.getA1Notation());
}
You can include editor info and previous values with some tweaks.
1.80 ๐ Duplicate a Sheet in Google Spreadsheets
Use:
var newSheet = sheet.copyTo(ss);
newSheet.setName("Backup_" + new Date().toLocaleDateString());
Automatically clone any sheet for backups, versioning, or template generation.
1.81 ๐งช Convert Google Sheet to Excel XLSX Spreadsheet
Use Drive API to export a Sheet as XLSX:
const file = DriveApp.getFileById(sheetId);
const url = "https://www.googleapis.com/drive/v3/files/" + file.getId() + "/export?mimeType=application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
Download or email the file as an Excel attachment.