Hello, i am trying to read from a .csv file which is in a defined location and thereafter manipulate the data.
I used to convert the .csv file manually to a .xls file and then import the.xls file and use it with the partial code below, however the new requirement is to read the .csv file directly.
Can anybody assist with the correct methods to read a .csv file and iterate through the lines.
Thanks
Michael
<=============>
var ImportFile = getpathandfile();
if(ImportFile!=null)
{
var Excelapp = Context.getExcelReader(ImportFile.getData());
var sheets = Excelapp.getSheets();
var currentSheet = sheets[0];
//var sheetname = currentSheet.getName();
var dataRows = currentSheet.getRows ( );
for(var m=0;m<dataRows.length;m++)
{
var data = new classData();
data.vAppName = dataRows[m].getCellAt(0).getCellValue ( );
data.vOS = dataRows[m].getCellAt(1).getCellValue ( );
data.vHardwareVendor = dataRows[m].getCellAt(2).getCellValue ( );
dataItems.push(data);
}
Hi Michael,
To read a CSV file, you have to open it and read it line by line :
Example, here I get all lines in an array :
Hope that helps.
Best Regards
Hello Tricarico, i thought there should be functionality like that. This made me realize I should rather look in the java api than in the minimalistic aris api to find functionality. Thanks for giving such a clear example, it works perfectly! :)