Micro Focus QTP (UFT) Forums
Need help - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Need help (/Thread-Need-help)



Need help - dinakargonuguntla - 08-11-2010

Hi,

Can any one let me know whether it is possible to read content in excel sheet and copy the same cell by cell in an windows application by using QTP. If so please provide some script.

please let me know asap

Thanks in advance,

Regards,
Dinnu.


RE: Need help - venkatbatchu - 08-11-2010

Hi Dinu,

We can solve your issue by following the below steps.

1. Import the Excel to QTP using [Datatable.Import "File Path"]
2. Find the row count in excel using [Datatable.GetRowcount]
3. Use the for loop to fetch the data from the excel [For temp=1 to rowcount Step 1
Datatable.setcurrentrow(temp) 'to fetch the corresponding row record i.e temp
4. Pass the value to windows object.

Ex: You have a object WinEdit to insert data then follow as per the below code.

Code:
Datatable.Import "File Path"
intrcount=Datatable.GetRowcount
For temp=1 to intrccount-1 step 1
Datatable.SetcurrentRow(temp)
Window("xxxxxxxxxx").WinEdit(xxxxxxxxxxx").Set Datatable.Value("Parameter Id","Sheet ID")
Next
Note: Here "Parameter Id" means column name in excel
Sheet Id means from which sheet you are fetching the data.


Please let me know for further clarification.

Regards,
Venkat.Batchu.