Skip to content

Instantly share code, notes, and snippets.

View cvrebert's full-sized avatar

Chris Rebert cvrebert

View GitHub Profile
@cvrebert
cvrebert / cr_csv.js
Last active January 29, 2022 02:19
Consumer Reports grid to CSV
// 1. View: Full View
// 2. Scroll to bottom of page until all entries are lazy-loaded.
function downloadCSV(content) {
let filename = 'CR_' + (new Date()).toISOString().replaceAll(/[T:.]/g, '_') + '.csv';
let a = document.createElement('a');
a.download = filename;
a.href = 'data:text/csv,' + content; // TODO: %-encode
a.click();
}