Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Comparing two excel files
#1
Solved: 11 Years, 3 Months, 4 Weeks ago
Hi guys...
i want to comapre two excel files.
the requirements for that are as follows.
1. First get the sheet count in both files if the count is not equal then exit and print the result.
2. copare the row count and column count
3. have to comapre the fonts,cell color,image etc.
4. have to compare the data in the files(row wise)
Note # wherever it fails then immediately it should show the error output and exit from run.

i have seperate code to get the count of sheets, and comparison of cell by cell that too for comparing excels having single sheet....
any one know how to do this?
please let me know....
thanks in advance
Reply
#2
Solved: 11 Years, 3 Months, 4 Weeks ago
1,2,4 are very easy.I give you code for color comparison

Code:
Set ex=createobject("excel.application")
Set wb1=ex.workbooks.open("E:\Testing\Framework\Data\a.xls")
Set wb2=ex.workbooks.open("E:\Testing\Framework\Data\b.xls")

Set sh1=wb1.activesheet
Set sh2=wb2.activesheet

colorSame=true

For each c in sh1.usedrange
color1=c.font.color
color2=sh2.range(c.address).font.color

    If clng(color1)<>clng(color2)Then
        colorSame=false
    End If

Next


ex.quit

Set sh1=nothing
Set sh2=nothing

Set wb1=nothing
Set wb2=nothing

Set ex=nothing
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  UFT taking different script execution timings while comparing 2 excel files. sudheer 0 2,355 06-26-2015, 03:28 PM
Last Post: sudheer
  Comparing webtable data with weblist and webelements in other webpage arnav 1 5,816 04-18-2014, 10:01 PM
Last Post: Parke
  Comparing two excel Sheets whose columns names vary Divya Roopa 2 8,654 03-26-2014, 07:20 PM
Last Post: Parke
  QTP Should open files(say txt files) it can be n number from a folder. Shiv Y 1 2,794 12-18-2013, 01:45 AM
Last Post: mlkrqtp
  Launch n-times QTP Test with different Excel Files nacchio 3 3,685 11-08-2011, 03:34 PM
Last Post: ravi.gajul

Forum Jump:


Users browsing this thread: 1 Guest(s)