After browsing Stack Overflow for a solution, I'm stuck on how to proceed. I am using a website to build a model of something and need to be able to read a CSV file laid out as shown below:
Variable Name 1, Value 1
Variable Name 2, Value 2
Variable Name 3, Value 3
The main issue is that the website only supports Javascript and their own API linked below: https://insightmaker.com/sites/default/files/API/files/API-js.html
The code that I am trying to write needs to be able to put the values into two separate arrays or one if need be and then read the variable name and the value and make changes.
Is this in any way possible without using separate JS plug-ins?
Any help would be greatly appreciated.
Thanks in advance
Edit:
The code that I have written so far looks like:
// This function comes from the API that Insight Maker Provides
openFile({
read: "Text",
multiple: false,
onCompleted: function(result,allText){storeData(result,allText);}
});
// The Main function of the code
function storeData(result,allText){
alert(result.contents);
var name = [];
var value = [];
var txt = "";
var space = ",";
var newline = "\n";
//var reader = new FileReader();
}
So far, the code that I have written successfully manages to output the full contents of the CSV file that is selected from the dialog box in an alert box.
What I am trying to do is to take the data from the CSV file and place it into an array.
An exaple of the code i'm trying to write is like this c++ code and find a substitute for this kind of code in javascript:
ifstream input("input.txt");
for (i = 0; i < 3; i++)
{
getline(input, text);
a[i] = text;
cout << text << endl;
}