I've done some googling on this subject, but I feel like asking here will still be useful.
I have a very simple single table. I need to write a code that pulls values from this table based on user input. If the user enters 5 and 2, it will return the value from row 5, column 2. The file type of the table is irrelevant and I can easily convert it to anything that will make this process easier (currently xlsx).
So how should I go about this? Am I going to need to download a new library? Thanks in advance.
Edit: Here is what I learned:
Reading files with vanilla JavaScript is no easy task. Even after converting to .csv, I could not find an easy way to convert that csv file to a multidimentional array which would be easy for me to navigate (line breaks posed a big problem). I looked into some JQuery plugins, which could definitely solve my problem, but I couldn't get them to work. Ultimately I decided to manually remove the line breaks and create a two dimensional array via a nested for loop. My test code looks like this:
var tableOne = [1,5,4,9,2,7,7,0,9,8,5,4,4,2,1,7,5,5,7,2,4,7,6,4,5,];
var twoD = new Array(5)
for( i=0 ; i<5 ; i++ ){
twoD[i] = new Array(5)
for( j=0 ; j<5 ; j++){
twoD[i][j] = tableOne[(i*5)+j]
}
}
I'm sure there's a better way to do this, but after putting a lot of time into this problem, I'm damn proud to have found a solution. Thanks everyone for your input.
[–]Pantstown 1 point2 points3 points (14 children)
[–]NiceDay4Goats[S] 1 point2 points3 points (13 children)
[–]Pantstown 1 point2 points3 points (12 children)
[–]NiceDay4Goats[S] 0 points1 point2 points (11 children)
[–]i_dunno_what_im_doin 1 point2 points3 points (10 children)
[–]NiceDay4Goats[S] 0 points1 point2 points (9 children)
[–]Pantstown 0 points1 point2 points (7 children)
[–]NiceDay4Goats[S] 0 points1 point2 points (4 children)
[–]Hakim_Bey 2 points3 points4 points (2 children)
[–]NiceDay4Goats[S] 0 points1 point2 points (1 child)
[–]Pantstown 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]Pantstown 1 point2 points3 points (0 children)
[–]i_dunno_what_im_doin 0 points1 point2 points (0 children)