03-14-2014, 02:58 PM
Hello shwetha...data table is different and excel is different...
if you wan t to read the data you should use some functions...i will send the sample code..you willl understand and try to google further...
'Create a new Microsoft Excel object
'To make Excel visible
'Save the Excel file as qtp.xls
'close Excel
'this is the name of Sheet in Excel file "qtp.xls" where data needs to be entered
'Enter values in Sheet1.
'The format of entering values in Excel is
///Try this.....u will get
if you wan t to read the data you should use some functions...i will send the sample code..you willl understand and try to google further...
'Create a new Microsoft Excel object
Code:
Set myxl = createobject("excel.application")
'To make Excel visible
Code:
myxl.Application.Visible = true
myxl.Workbooks.Add
wait 2
'Save the Excel file as qtp.xls
Code:
myxl.ActiveWorkbook.SaveAs "D:\qtp.xls"
'close Excel
Code:
myxl.Application.Quit
Set myxl=nothing
////To enter some data
myxl.Workbooks.Open "D:\qtp.xls"
myxl.Application.Visible = true
'this is the name of Sheet in Excel file "qtp.xls" where data needs to be entered
Code:
set mysheet = myxl.ActiveWorkbook.Worksheets("Sheet1")
'Enter values in Sheet1.
'The format of entering values in Excel is
Code:
excelSheet.Cells(row,column)=value
mysheet.cells(1,1).value ="Name"
mysheet.cells(1,2).value ="Age"
mysheet.cells(2,1).value ="Ram"
mysheet.cells(2,2).value ="20"
mysheet.cells(3,1).value ="Raghu"
mysheet.cells(3,2).value ="15"
///Try this.....u will get