How to read within a Data File and used one cell value as comparison in a condition

Hello, i have a Data File consist of 3 columns (
|Users|Password|MemoConn|) and see attached screenshot how it looks.

At runtime, using script, i want to read the column MemoConn to check the value and used the value to perform a calculation.

Could someone help please?

Hi Ziyaad,

Is your data file an excel file? If yes, you can refer to this link on how to read data file.

Hope that helps. . .:slight_smile:

Helo Arnel, it is not an excel…im using the datafile in katalon itself

Could any one help?

Dear Arnel, can you please advice?

So you’re using Internal Data I suppose?


I don’t get this part. . .

that’s why I asked if your using InternalData.

For what I know when creating a data file you are required to choose what file are you going to import (e.g. excel, csv, DB file, or internal data) may I know what data type did you choose?


Arnel, sorry for the confusion i gave you…yes i’m using InternalData


download postgres db tool, it’s free, best way to handle testcase data :sunglasses:

Hello Timo, my issue here is not about storing the data, its about having a column whereby at specific rows, it will have a data and that data i need to compare this to perform a check and later on to do an action on the screen.

As a starting point, i’m using the InternalData with string type.

Dear Arnel, yes i am using InternalDataFile with type String.


e.g you can fetch needed data by row index from the db

//get rowdata to list by index number
List<String> rowData = new ArrayList<>()
rowData = CustomKeywords.'postgresUtil.postgresHandler.getRowDataById'(newRow)
String fName = rowData.get(1)
int personAge = Integer.parseInt(rowData.get(2))
String add = rowData.get(3)
double sal = Double.parseDouble(rowData.get(4))
String personSsn = rowData.get(5)
then use it in test case

	public List<String> getRowDataById(int idx){

		List<String> rowData = new ArrayList<>()

		try {
			c = DriverManager
			System.out.println("Opened database successfully");

			String SQL = "SELECT * FROM COMPANY WHERE id = ?";

			pstmt = c.prepareStatement(SQL);
			pstmt.setInt(1, idx);

			ResultSet rs = pstmt.executeQuery();
			while ( ) {
				int id = rs.getInt("id");
				String  name = rs.getString("name");
				int age  = rs.getInt("age");
				String  address = rs.getString("address");
				float salary = rs.getFloat("salary");
				String  ssn = rs.getString("ssn");
				if (id == idx){
					System.out.println( "ID = " + id );
					System.out.println( "NAME = " + name );
					System.out.println( "AGE = " + age );
					System.out.println( "ADDRESS = " + address );
					System.out.println( "SALARY = " + salary );
					System.out.println( "SSN = " + ssn );

		} catch ( Exception e ) {
			System.err.println( e.getClass().getName()+": "+ e.getMessage() );
		System.out.println("Operation done successfully");
		return rowData

Hi Timo, the solution you provided me is too complexe. What i really need is that when Katalon is going to execute the first row of data, the last column at times will have data and at times not.

What i want at run time is that, when executing the first row of data, it should check the value of the last column is not null and contain a value and that value will be check which types of action.

Let me if it is clear?


like this code snip

List<String> columns = new ArrayList<>()

InternalData data = findTestData('SpamData/someSpamTestData')
String column
int x = 0
int y = 0
message = "column has not value!!!!"
KeywordUtil log = new KeywordUtil();

for (def index : ( - 1)) {
	for (int k = 0; k < columns.size(); k++){
	column = data.internallyGetValue(columns.get(k), x)
		if (column.equals("")){
                    log.markWarning("column "+columns.get(k)+ " row "+x+" has not data "+column);
			//log.markError(message +columns.get(k)+ " row "+x );
			//throw new com.kms.katalon.core.exception.StepErrorException("cell is null")
			println "column "+k+ " row "+x+" data "+column
	if (y >= data.getRowNumbers() - 1)

column has not value!!!! first row 0
2019-04-03 20:28:01.371 WARN  com.kms.katalon.core.util.KeywordUtil    - column first row 0 has not data
column 1 row 0 data two
column 2 row 0 data cow
column 0 row 1 data dog
column has not value!!!! second row 1
2019-04-03 20:28:01.654 WARN  com.kms.katalon.core.util.KeywordUtil    - column second row 1 has not data
column 2 row 1 data cat



Hi Ziyaad,

Timo’s code is the one you are looking for but I think its hard for you to understand it, so, I’m going to make it simple. You can do this since you only need to read MemoConn column.

//locate your internal data
InternalData iData = findTestData("your_internal_data")

//this is to print all the values
println iData.getAllData()

//this is to specify the column you want to use
//parameters should be column name and the row number will start at 1
iData.getValue("ColumnName", 1)


//instead of column name, use the index of the column
//first parameter is for the column and second parameter is for the value/row number
iData.getValue(1, 1)

//Sample condition
if (iData.getValue("MemoConn", 1).contains("App")
     // do something
     // do something

Props to Timo by the way :slight_smile:

Hope that helps. . :slight_smile:


Thanks it is really helpful.

Hi @Arnel In my CSV i have 4 different kind of names in one column based on that particular row text i need to select the drop down in WebUI which contains the CSV row name,How can i implement this can you pls help me.

Hi @bhargavia,

May I know the html source/locator of that drop down? because you can do that by comparing the value of your CSV to the value of your dropdown, thats why I need to know the locator, you need to get the dropdown items first before comparing it to your csv data… If it matches then it will be selected.


Hi @Arnel Thank You i used switch case it’s working.And one more doubt how can we download the files into different directories currently i’m downloading all different kind’s of files(CSV & PDF’s) into one directory could you please help me.

Hi @bhargavia,

Can you share your code snippet for this?