Verify column headings in excel

Hi guys,

I have to open an excel file using Katalon (able to export the file and open it using the robot class!), verify the text present in the column heading of the sheet and then close the excel file. Was going through the general discussions here, but kind of lost.

Thanks in advance,
Saumil

during your search saga on the forum topics, you did’nt fond a pinned topic ‘help us to help you’? just curious…
code samples please so we can have an idea what do you intend to achieve … and how.

Hi @Ibus, I assumed that someone would guide me on how to write the code for verifying the excel text hence did not post the code (my bad). This is what I am doing (to open the excel sheet):

Robot robot = new Robot()

robot.keyPress(KeyEvent.VK_ENTER)

robot.keyRelease(KeyEvent.VK_ENTER)

WebUI.delay(5)

At this stage, the excel sheet opens up :
ask

And this is where I get lost as I have to verify the column heading names present in the first row and then close the excel sheet afterwards:

1 Like

Does this help?

Not really as I also have to close the excel sheet after verifying the headings present( and not the data)

That makes no sense to me - unless you want to verify Excel itself (in which case you want the Desktop APIs).

This sounds stupid but I have to verify the heading names present in the Excel sheet. What kind of Desktop API’s should I use? Can you please shed some light on it?

Isn’t that typically the first row of the file? I don’t use Excel but I’m sure the first row is readable the same as any other row.

Yes it’s the first row of the file. But is it really possible to verify Excel row in an EXCEL FILE and then close it?

Does “close it” make sense? You’re not opening Excel, you’re reading an Excel data file. I don’t do data driven testing (at least, not using external files) but I’m sure you just setup your connection to Excel, read a data file, test your data, end of story.

I think you should watch that video. It would save me having to watch it :wink:

At this stage, the *.xslx file is handled by the application of Microsoft Excel, not by Katalon Studio. Your test script in Katalon Studio knows nothing about the running Excel process and the downloaded *.xls file. Katalon Studio can do nothing to that.

You need to step back. You need to find out how to write a Katalon Studio test case which downloads the *.xlsx file from a web page into a local location on your PC so that your test case script can find the file locally. Opening the Excel file, verifying its row, closing it — these questions should be addressed later.

You should show us how the HTML of your “Download page” looks like. Does it have <a href="url of *.xslx file">file</a>? In other words, can you find the URL of the target file readable from the DOM of the web page? Or, is the URL dynamically generated by JavaScript on click a button? All these details matter for writing downloader codes appropriately.

1 Like

In the following post, I introduced a custom keyword

downloadAndSave(String fileURL, Path dir, String fileName)

If you can scrape the URL of Excel file to donwload out of the web page, you can easily download and save the file using that keyword.

Sorry for the late response, was on leave. The steps described in the video worked really well :slight_smile:

1 Like