Created
March 27, 2024 19:27
-
-
Save alecbw/a14fab00e58be94c7540905fcb4283df to your computer and use it in GitHub Desktop.
Revisions
-
alecbw created this gist
Mar 27, 2024 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ rows = document.querySelectorAll('.tk-list-item-wrapper'); csvData = []; rows.forEach(row => { texts = Array.from(row.querySelectorAll('[data-toolkit-component="Text"]')) .map(element => { let text = element.textContent.trim(); // Check if text matches "completed DD/MM/YYYY" and extract the date let match = text.match(/completed (\d{2}\/\d{2}\/\d{4})/); return match ? `"${match[1]}"` : `"${text}"`; // Add quotes for CSV format }); csvData.push(texts.join(',')); }); csvString = csvData.join('\n'); blob = new Blob([csvString], {type: 'text/csv'}); // create a button we can click to download the CSV downloadUrl = URL.createObjectURL(blob); downloadLink = document.createElement('a'); downloadLink.href = downloadUrl; downloadLink.download = 'data.csv'; document.body.appendChild(downloadLink); downloadLink.click(); document.body.removeChild(downloadLink);