getCSVForFileName
Description
Retrieves a raw CSV string and parsed object array for the first CSV file with the given name.
Syntax
VabletNativeInterface.callNativeMethod('getCSVForFileName', {fileName: 'CSVFile'}, (res)=>{...})
Options
| Key |
Type |
Description |
| fileName |
string |
fileName of the CSV file to be parsed. Will return the first file found matching the name. |
Response
| Key |
Type |
Description |
| success |
boolean |
Returns true on success and false for any errors. |
| error |
string |
Error message, provided there is one. |
| csvString |
string |
A string containing the raw CSV data. |
| parsedCSV |
object |
A parsed object from the CSV data. Uses the first row for key names. |
Example
VabletNativeInterface.callNativeMethod(
'getCSVForFileName',
{fileName: 'CSVFile'},
(res)=>{
if (res.success) {
// Success! Extract values from response
const {csvString, parsedCSV} = res;
// Do something!
alert("Raw CSV Data", csvString);
alert("Parsed CSV Object", parsedCSV);
} else {
// Uh oh, let's alert the error!
alert(res.error)
}
}
);