Skip to content

Instantly share code, notes, and snippets.

@dot-mike
Created April 11, 2025 19:35
Show Gist options
  • Save dot-mike/3514cd8b904a5f84e0e4db013fe0615e to your computer and use it in GitHub Desktop.
Save dot-mike/3514cd8b904a5f84e0e4db013fe0615e to your computer and use it in GitHub Desktop.
Speedtest.net export speedtest to csv from website
(function () {
const rows = document.querySelectorAll('tr.result-row');
const csvRows = [];
// CSV Header
csvRows.push([
'Date',
'Time',
'Ping (ms)',
'Download (Mbps)',
'Upload (Mbps)'
].join(','));
rows.forEach(row => {
const cells = row.querySelectorAll('td');
const dateTimeParagraphs = cells[0].querySelectorAll('p');
const date = dateTimeParagraphs[0]?.childNodes[1]?.textContent.trim();
const time = dateTimeParagraphs[1]?.childNodes[1]?.textContent.trim();
const ping = cells[1]?.textContent.trim();
const download = cells[2]?.textContent.trim();
const upload = cells[3]?.textContent.trim();
csvRows.push([
date,
time,
ping,
download,
upload
].map(cell => `"${cell}"`).join(','));
});
const csvContent = csvRows.join('\n');
const blob = new Blob([csvContent], { type: 'text/csv' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.setAttribute('href', url);
a.setAttribute('download', 'speedtest_results.csv');
a.click();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment