Contributions
Search for a value in Excel
Hi Team, This is for Data comparison (between 2 excel sheets). I'm taking a ID value (Primary key) from Excel1 (Source data) and locating that ID value in Excel2 (Target data). Once located, comparing the columns between both the Excel Sheets. Currently comparison is working fine but taking more time to search the ID value (if that ID is located somewhere in the end of Excel) Is there any optimized way to search for a value in Excel. I remember, for Text files we haveReadToSymbol(SubString). Once located we can convert String positions into Lines (match(/\n/g) || '').length). Not sure if we have any such simple mechanism for Excel Search (to avoid more no .of iterations). For Ex: If i want to search for "1234" in ID Column which is having 10,000 rows. If "1234" placed in 9000 row, then it has to iterate 9000 times which is taking more time. Is there any better way to locate the value? I tried DDT as well (while (! Driver.EOF() ). Taking even more time. Sample code: function Search() { var excelFile = Excel.Open("C:\\Users\\___\\Desktop\\Test_Data.xlsx"); var excelSheet = excelFile.SheetByTitle("Sheet1"); var CompareValue='1234'; var RowCount=excelSheet.RowCount; for(var j=0;j< RowCount;j++) { var ExcelValue= excelSheet.Cell(1,j+2).Value; if(CompareValue==ExcelValue) { Log.Message("Matching"); break; } } }267Views0likes1CommentGet Excel Row Index for a given String
Hi Team, Could you please guide me to search for a String in Excel Sheet and get the Index/ address of that Cell. For ex: In the below Excel Table, i need to search for "Fruit_ID_2" in PrimaryKey Column and get the Row Index for it. _______PrimaryKey--------Coumn2 Row1 Fruit_ID_1_______Orange Row2 Fruit_ID_2______Kiwi277Views0likes1Comment