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.

Insert-a-Column-to-an-Excel-Sheet-UFT2

Delete a Column of an Excel Sheet

Conclusion

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

Leave a Reply