Created
February 19, 2025 23:42
-
-
Save robfe/fcb7f304fb49a9aeca4bcb028409e10e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var d = []; | |
var table = document.querySelector('table'); // make this selector more specific! | |
d.push([...table.querySelectorAll('thead>tr>th')].map(x=>x.innerText)); | |
table.querySelectorAll('tbody>tr').forEach(r=>d.push([...r.querySelectorAll('td')].map(x=>x.innerText))); | |
var s = d.map(r=>r.map(JSON.stringify).join(',')).join('\n'); | |
// copy(s); // copy to clipboard | |
window.open("data:text/csv;charset=utf-8,%EF%BB%BF"+encodeURI(s)); // download as CSV |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment