hi guys i want to read an ip address from an excel file and compare it to a datatable,
an excel cell containing ip address 10.9.8.7, i read the 10.9.8
another excel file with table :
IP_address | Name
10.9.2 | a
10.9.5 | b
10.9.8 | c
and then in the first excel i write c in the cell next to the 10.9.8.7 ip address
- how can i read only the 10.9.8 ?
- how do i compare it to the table in another excelf file ?
I assume you now how to read excel cells.
if you have the data of the cell with the whole ip address stored in a variable of type String you can do the following:
- Activity “Assign”: indexOfLastPoint = ipAddress.LastIndexOf(“.”)
- Activity “Assign” and substring: ipAddressSubstring = ipAddress.Substring(0,indexOfLastPoint)
now ipAddressSubstring contains your 3 segments.
i did some error handling but here is my project.
you can read the range of the 2nd excel data sheet and search for the same ip address.
After that just use the “write cell” activity and you are done.
@madschilos what’s the  and  in the second answer means ? i get an error like this
@RobertoEwaldo your variable dt should look like:
for each row iterates throught all rows. if you select row its the first column of the row (the ip Adress).
row stands for the letter (for example ‘a’).
the compiler already throws an exception. My guess is ipAddrSubstr is not existing!?
@madschilos i think my problem is with the array, the error is gone when i try to delete the array. can you please check what’s wrong ?
Main.xaml (12.8 KB)
@RobertoEwaldo change your condition to String.Equals(ipAddrSubstr, row(0).ToString())
i am using c# and you are using vb.net that was the difference.
@madschilos oh my bad thanks it worked bro
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.