Hi
How can i read the value in the last line in csv with Katalon Recorder ?
Thanks for suggestion
Hi
How can i read the value in the last line in csv with Katalon Recorder ?
Thanks for suggestion
hello,
//in this example i have two columns in csv file and five rows
BufferedReader br = new BufferedReader(new FileReader("C:\\Users\\xxxx\\Desktop\\data\\csv1.csv"));
List <String> arr = new ArrayList<>()
int i = 0
while ((line = br.readLine()) != null) {
// use comma as separator
String[] cols = line.split(";");
arr.add(cols[0])
arr.add(cols[1])
i++
System.out.println("Coulmn 0= " + cols[0] + " , Column 1=" + cols[1]);
}
println arr
def latest = arr[arr.size() - 1];
println latest // here is the latest cell data
2019-05-02 19:31:23.412 DEBUG testcase.blob - 5: println(arr)
[one, yksi, two, kaksi, three, kolme, four, nelja, five, viisi]
2019-05-02 19:31:23.448 DEBUG testcase.blob - 6: latest = arr[arr.size() - 1]
2019-05-02 19:31:23.612 DEBUG testcase.blob - 7: println(latest)
viisi