Selenium: Excel Read and Write – using java jExcel(jxl)

————————————————————————————————————————-
According to http://jexcelapi.sourceforge.net/ – jexcel API is to read and write excel sheet data,

Note:

  • Excel should be of .xls format , if it is a .xlxs format, then open the excel and click onFile -> Save As and choose “Excel 97-2003 WorkBook” format.
  • We can’t edit an existing excel, but can create a new excel(copy existing excel content) and update the content.

Required jar file: jxl.jar, click here to download the zip jexcelapi and get the required jar file.

Steps:
Place the excel file under the project folder (for ease access)
Enter excel data something like this:

testdata.xls

Here, 1st row is the column header / description.

Code to read and write an excel file:


And the output is:

Content posted is based on learning or working experience, please leave comments if anything needs to be added or updated, discuss your queries on our facebook:qavalidation.com, Thanks!

2 Responses

  1. Mukesh says:

    Hey Sunil,

    Finally back again…. Waiting for more post.. Cheers 🙂

  2. Admin says:

    Thanks buddy, this helps us to learn..
    U too keep sharing, so we can learn more…

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: