Created
October 1, 2022 21:20
-
-
Save lee2sman/c7d043ebdb0a3a6df98585394f2e5628 to your computer and use it in GitHub Desktop.
No library required. Imports a TSV (tab separated value) text file, then splits it to an array of lines, each split into an array separated by tabs.
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
fetch("cal.tsv") | |
.then((response) => response.text()) | |
.then((data) => { | |
//split text file by newline and tab | |
//thanks to stackoverflow https://stackoverflow.com/questions/47876718/splitting-text-file-by-newlines-and-tab-in-javascript | |
timetable_data = data.split("\n").map(function (ln) { | |
return ln.split("\t"); | |
}); | |
//returns array of timetable data by line, separated on each line by tab separated value | |
console.log(timetable_data); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment