Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Reading data from excel sheet
#1
Hi,

I need a script which can read data from an excel file( where the data is already given) and give the same inputs in a windows application.Is it possible to import the data from the excel sheet without using Datatable.importsheet statement ?? Please help Smile
Reply
#2
⇒Read the data from Excel File:
Code:
Set myxl = createobject("excel.application") 'Make sure that you have created an excel file before exeuting the script. 'Use the path of excel file in the below code 'Also make sure that your excel file is in Closed state 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 set mysheet = myxl.ActiveWorkbook.Worksheets("Sheet1") 'Get the max row occupied in the excel file Row=mysheet.UsedRange.Rows.Count 'Get the max column occupied in the excel file Col=mysheet.UsedRange.columns.count 'To read the data from the entire Excel file For i= 1 to Row For j=1 to Col Msgbox mysheet.cells(i,j).value Next Next 'Save the Workbook myxl.ActiveWorkbook.Save 'Close the Workbook myxl.ActiveWorkbook.Close 'Close Excel myxl.Application.Quit Set mysheet =nothing Set myxl = nothing
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Reading Global Sheet's DataTable Value Bhuvana 0 2,074 01-05-2020, 10:03 PM
Last Post: Bhuvana
  Reading Value from Java Table arjun.singh 8 25,836 10-11-2017, 02:51 PM
Last Post: sivaji
  Want to read the data from excel and set read value in the JavaTable rajeevk7 0 2,817 07-10-2017, 04:20 PM
Last Post: rajeevk7
  dtLocalSheet empty even though excel file contains data cantorre 2 3,133 05-10-2017, 12:47 PM
Last Post: vidhi
  QTP not reading all properties ishan.mahajan@adp.com 2 2,943 05-04-2016, 10:50 PM
Last Post: supputuri

Forum Jump:


Users browsing this thread: 1 Guest(s)