Read, Write and Update Excel Sheet In UFT

Reading and writing data from an Excel file plays a crucial role. There would be hardly an automation framework where data might not be read from an Excel file for taking input dynamically at runtime.

We will see the following useful functions to play around with an Excel Sheet with QTP/UFT.In this tutorial, I will be using E:\Test\TestData.xlsx as the path of the Excel file. Change it according to your local machine.

Read Excel Sheet Cell Values One by One for all Columns

Read Excel Sheet Cell Values One by One for all Rows

Read data from a specific cell in Excel Sheet

Write data to a specific cell in Excel Sheet

The following function can be used to write data to the required cell.

Count Sheets in an Excel file

Insert a Column to an Excel Sheet

The below code can be used to insert a column at the right side of the specified cell range.Read, Write and Update Excel File In UFT

After adding a column the sheet will look like the below snapshot.


Delete a Column of an Excel Sheet


We have learned how to perform various operations on Excel SpreadSheet in UFT.Hope you will find this article helpful.Please don’t forget to share it and if you have any questions/queries, please do mention them in the comment box.

Recommended Posts

This Post Has 2 Comments

  1. Rajasekhar

    I am getting error at line number 5 for the below method.

    Read data from a specific cell in Excel Sheet

    1. Sarfaraz Alam

      Hi Rajasekhar

      You have not mentioned what error you are getting. All I can suggest you please check whether you are giving a valid sheet name. Hope it will sort out your issue.

Leave a Reply