Pre-requisite : Have an excel file names c:\data.xls with data in 3 rows and 3 columns, remember to close the excel file before running the script.
QTP Code to read an excel file
Dim arr() ' Declares the array arr
zRead_frm_Excel "c:\data.xls","Sheet1",1
For i=0 to ubound(arr)-1
msgbox arr(i)
next
' This function is to read and close the xl | arg1=path of xl, arg2=sheet name, arg3=startn row
Function zRead_frm_Excel(xl,sheet,srt_row)
Set xlApp = GetObject("","Excel.Application")
xlApp.visible = true
Set xlWrkbk = xlApp.Workbooks.Open(xl)
Set xlWrksht = xlWrkbk.Worksheets(sheet) ' Data is the name of the sheet
intStartRow = srt_row ' Row from whcih you need to start
row_cnt= xlWrksht.UsedRange.Rows.Count
ReDim arr(row_cnt)
ub= ubound(arr)-1
i=0
For intRow = intStartRow to xlWrksht.UsedRange.Rows.Count
strAccountNumber = Trim(xlWrksht.Range("A" & intRow)) ' Column A
strAccuntName = Trim(xlWrksht.Range("B" & intRow)) ' Column B
dtDate = Trim(xlWrksht.Range("C" & intRow)) ' Column C
arr_value=strAccountNumber&strAccuntName&dtDate
arr(i)=arr_value
i=i+1
Next
xlApp.Quit
Set xlApp = Nothing
zRead_frm_Excel=arr
End Function
Thirukkural - Thathuva, Yoga, Gnayna Urai || திருக்குறள் - தத்துவ யோக ஞான
உரை
-
*திருக்குறள் - தத்துவ, யோக, ஞான உரை *
*Thirukkural - Thathuva, Yoga, Gnayna Urai*
This book is written with 40 years of research on Thirukkural and a...
0 comments:
Post a Comment