how to compare excel with datatatble - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners) +--- Thread: how to compare excel with datatatble (/Thread-how-to-compare-excel-with-datatatble) |
how to compare excel with datatatble - diya - 11-29-2012 Hello All, I have a basic knowledge in QTP.Right now we are learning as well as developing scripts for our application. I want to retrieve data stored in .xls sheet,first row,first column & compare this retrieved data with the data outputted in the data table in QTP.we are using QTP9.2.Actually the thing is,in our application,we have an 'About' box which displays the version no. of the build.I want to check whether this version no.is correct & as per latest updations in the .xls sheet from developer.So I have used output value to output this version no. in data table.Now i want to comapre the two values,one in the QTP data table & 2nd in the .xls sheet.I have tried many combinations,but all are failing. Can you please help me put in this.I am not well versed in descriptive programing. Plz do reply asap. Thanks.. This was asked by someone i tried but could not get please reply as how to go.... first step would be importing the excel sheet to datatable using datatable.import after that please lemme know what to do RE: how to compare excel with datatatble - kordirko - 12-03-2012 You can import the excel sheet into the data table, here is an example Code: DataTable.AddSheet("mysheet") .... but the problem with this method is that QTP treats the first row of the file as columns' headers (names), so you cannot read values from the first row, you can read values only from the second and subsequent rows. There is another method - you can open the excel file using directly Excel.Application object, here is an example: Code: Dim objExcel, objWorkBook RE: how to compare excel with datatatble - diya - 12-03-2012 Hello, Thanks for the reply... i did not understand what you are tryign to telllis it regarding the import... then how do i compare please help RE: how to compare excel with datatatble - kordirko - 12-04-2012 When you import an excel file into QTP table, values stored in first row become column names in QTP table. For example, if your spreadshed contains these values: Code: +------+------+------+------+ then after importing this spreadsheet into the datatable you get: Code: +------+------+------+------+ Values from the first row in the excel spreadsheet are used as column names in QTP datatable. RE: how to compare excel with datatatble - diya - 12-04-2012 Thanks that was really very neatly explained. iam really thankful. trying to do the comparison...trying out but not getting it |