Working with Excel

If I ask you to tell about Microsoft Excel. What can you think of? It is an excel workbook which contains sheets, cells, table like structure  where we write data , read data etc.

Same operations, we can perform through coding. We need to create sheet,delete sheet, read data , write data,compare data etc.

As a first point, we need to create an excel object instance using method ‘createobject’. Let’s learn how to perform all these operations.

Creating an Excel workbook and save it at any location :

Open an existing excel and rename its first sheet:

Open an existing excel and write some data in the renamed sheet:

ExcelWrite

Count the no. of rows and columns in excel sheet:

Output
Total rows are 3 Total columns are 2

Read data from excel sheet:

Delete the sheet:

Compare data between 2 excel sheets:

ExcelCompare

Note: Note:
we should close the workbook and excel instance after use. Otherwise, instance will not be close and on next run program will throw an error that sheet already opened.
All about loop in UFT
Conditional statements
Shekhar Sharma

Shekhar Sharma

Shekhar Sharma is founder of testingpool.com. He is an automation engineer having more than 8 years of experience who loves troubleshooting in automation and finding innovative ways to solve the problems. His other leisurely activities includes playing harmonica, paintings, sketching portrait, watching movies and travelling etc.

You may also like...

Leave a Reply

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