Created
October 24, 2022 20:34
-
-
Save TechplexEngineer/23bf89a4bc33571432612451752bb8fe to your computer and use it in GitHub Desktop.
Export team roster from FIRST dashboard
This file contains 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
(()=>{ | |
function convertToCSV(arr) { | |
const array = [Object.keys(arr[0])].concat(arr) | |
return array.map(it => { | |
return Object.values(it).toString() | |
}).join('\n') | |
} | |
if (typeof ContactRosterModel == "undefined") { | |
alert("Unable to find roster on this page."); | |
return; | |
} | |
const csvData = convertToCSV(ContactRosterModel.TeamStudents); | |
const csvStr = "data:text/csv;charset=utf-8,"+csvData; | |
var encodedUri = encodeURI(csvStr); | |
var link = document.createElement("a"); | |
link.setAttribute("href", encodedUri); | |
link.setAttribute("download", "TeamRoster.csv"); | |
document.body.appendChild(link); | |
link.click(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment