18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
Get the number of rows from a file
I have a .CSV file with data entered. The file is in /userdata/scripts folder.
Please let me know how to get the number of rows (with data) from this file.
Please let me know how to get the number of rows (with data) from this file.
Answers
hope the below code will help u
The below one (with just one 'For' loop) make it much simpler for my requirement.
var $data_CSV = [];
var $csvFilePath = "getRowCount.csv";
var $data_CSV = _readCSVFile($csvFilePath);
try
{
for(var $cnt_Row=0; $cnt_Row<$data_CSV.length; $cnt_Row++)
{
//_alert ($cnt_Row);
}
_alert ("Total rows in the input file is " +$cnt_Row);
}
catch($e)
{
_logExceptionAsFailure("Exception: "+ $e);
}
Thanks. It helped.
one more thing i wanna update.
if u wanna know only Total rows from the file then u can use as
_alert("Total rows in the input file is: "+ $data_CSV.length); // instead of $cnt_Row
Below is the modified total code
Thanks for the update. It works now.