Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem in accessing data from excel sheets
#1
Not Solved
Dear All,
I have posted this thread earlier also but no repies thatswhy I am posting again with more detailed way so that any one can help me.

The project contains 7 excel files, out of which one is main file and other 6 are sub files. QTP script is written in such a way that first script access main file (contains header-Yes or No and TestCase-Name of Test Cases). If header is Yes corresponding file will open out of 6 sub files and will access the data. One more thing is here Main file contains 6 rows and sub file contains only one row. During script run main file is accessing and even though the header is No it is trying to access the data and is giving error messages, Also it tries to access more than one row in the sub files where as only one row is present.

Please see the code below, data and Screen shots in attachments

Code:
DataTable.Import "C:\SAR\Data\Main.xls"
Rows = DataTable.GetSheet("Global").GetRowCount

For i =1 To Rows
     DataTable.SetCurrentRow(i)
     Header = DataTable.GetSheet("Global").GetParameter
     ("Header").RawValue
     TestCase= DataTable.GetSheet("Global").GetParameter
     ("TestCase").RawValue

     If Header="Yes" Then
        DataTable.Import "C:\SAR\Data\"&TestCase&".xls"
        Rows1 = DataTable.GetSheet("Global").GetRowCount
        For j=1 To Rows1
             DataTable.SetCurrentRow(j)
             FirstName = DataTable.GetSheet("Global").GetParameter
             ("FirstName").RawValue
             MsgBox FirstName
            Next

     Else
        DataTable.Import "C:\SAR\Data\Main.xls"
        DataTable.SetNextRow
  
     End If
Next
Please have look into the code as well as attachments and give me work around to get out of this problem

Thanks in Advance
Narasimha


Attached Files
.zip   Data.zip (Size: 13.09 KB / Downloads: 79)
.doc   Execution Screens.doc (Size: 401 KB / Downloads: 94)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Compare Two ex cel sheets and highlight differences neerukonda9 17 14,080 06-03-2020, 12:04 PM
Last Post: rajrk
  Want to read the data from excel and set read value in the JavaTable rajeevk7 0 2,317 07-10-2017, 04:20 PM
Last Post: rajeevk7
  dtLocalSheet empty even though excel file contains data cantorre 2 2,434 05-10-2017, 12:47 PM
Last Post: vidhi
  Reading data from excel sheet serenediva 1 9,621 03-03-2017, 10:07 AM
Last Post: vinod123
  Comparing two excel Sheets whose columns names vary Divya Roopa 2 8,654 03-26-2014, 07:20 PM
Last Post: Parke

Forum Jump:


Users browsing this thread: 3 Guest(s)