VBScript - How to import data from an Excel File to DataTable in QTP. Only import rows of data in Excel that are not empty rows.
[First delete empty rows as below and them import data.]
Set objExcel = CreateObject("Excel.Application")
objExcel.WorkBooks.Open "C:\Documents and Settings\thirumalv\Desktop\thi.xls"
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)
rowcount=objSheet.usedrange.rows.count
For i = 1 To rowcount
If objSheet.cells(i,1).value="" Then
objSheet.Rows(i).delete
i=i-1
rowcount=rowcount-1
End If
If rowcount =i Then
Exit for
End If
Next
objExcel.ActiveWorkbook.save
objExcel.ActiveWorkbook.Close
objExcel.Application.Quit
Set objExcel = Nothing
Set objSheet = Nothing
[Via]