Skip to content

Instantly share code, notes, and snippets.

@saswata-dutta
Last active July 24, 2022 15:05
Show Gist options
  • Save saswata-dutta/5c8be8c0b23fda1819529947fb3d8184 to your computer and use it in GitHub Desktop.
Save saswata-dutta/5c8be8c0b23fda1819529947fb3d8184 to your computer and use it in GitHub Desktop.
extract csv from webpage table
rows = document.querySelectorAll('tr.???');
cellText = cell => cell.innerText;
rowText = r => Array.from(r.getElementsByTagName("td"), c => cellText(c)).join('|');
csv = Array.from(rows, row => rowText(row)).join("\n");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment