Read Test Data from Excel


I am trying to read data from an excel file at Test case level.

I am able to read test data from excel ( from sheet 1).

I also have test data in sheet 2 of the excel file which I need to read in the same test case. How can I do this?

Please let me know.



depends on how your script will read excel?

read again with another sheet name as parameter
you have to implement keyword where the sheet name is used as parameter

	public List<String> readExcelRows(int start, int end, String path, sheetName) throws IOException, InvalidFormatException{

            workbook = WorkbookFactory.create(new File(SAMPLE_XLSX_FILE_PATH));

		// Getting the Sheet as sheetName
		Sheet sheet = workbook.getSheet(sheetName);

Thanks Timo for your help!!!

I was using findTestData( ) and getValue( ) methods from katalon studio API.

below is snippet:

    WebUI.setText(findTestObject('Object Repository/Page_Login  Salesforce/input_Username_username'), findTestData('Automation Test Data').getValue(
            'UserName', 1))
    WebUI.setEncryptedText(findTestObject('Object Repository/Page_Login  Salesforce/input_Password_pw'), findTestData('Automation Test Data').getValue(
            'Password', 1))

If I have to use them and also read the data from another sheet, Do i need to create a custom getValue( ) method with sheet as parameter? OR does katalon studio API has a predefined method to perform this task.

Please let me know.

Hi @umas181929

There’s no native API in katalon to help read values from different sheets. However, there’s a Read Write Excel Custom Keyword Plugin that may interest you.

Cheers !

Hi Umakant,

Kindly see the link below… You can read in different excel sheets using this approach. . .

Hope that helps. . . :slight_smile:

hi you,

`I am not using Katalon excel plugin, I have implemented own excel read / write keywords to my use, with this way i’ll get just that how I will use the excel functions

Hi Thanh.
I have read the excel file in a specific location.I have a code for that.
Still my excel file name varies always.
But it starts with constant number followed by varying characters.
eg “01123_bfkjenfkennkn.xlx”
number 01123 is constant always.
Pls help me how to refer this excel in my code.