Wednesday, May 21, 2008

QTP Script 7 - How to copy data from Excel sheet to a Text file?

How to copy data from Excel sheet to a Text file?

You can manipulate the below script to meet your requirements.

A text file sample.txt exists in the C:\ drive. Sample.txt is opened in append mode which is 8. We use writeline to write each line into text file.

An Excel file Book1.xls exists in C:\ drive and it has some text in columns and rows of its sheet1. In the For loop we are transferring data from first three rows of excel sheet to a text file called sample.txt.