I have an excel file wherein I need to look through a row value and a column value. After that I want to write some value in it. For example, in below screen shot, I need to find where “RowValueToBeSearched” and “ColumnValueToBeSearched” are written and then I need to feed my input in their intersecting cell address “H5” in below example.
How to do that?
For example if you want to get row value ex. row(0). tostring and save it in another variable using assign. then H row value as row(7).to string and save it in another variable using assign. Create these to inside for each. so it will read each row first column and 7 th column values.
Can you please be more elaborative and stepwise? I hope you got my question. I don’t need excel cell values. I want excel cell address based on intersecting cell values.
cell address starts with 0. for column A cell address is 0.
use row (3).tostring for d column. assign the value to column and write it back to datatable then use write cell option.
Specify your req.
My Requirement is simple. Stepwise I would like to do something like below:
- Search for “ColumnValueToBeSearched” and store its column index (or name) in a variable (say “column”)
- Search for “RowValueToBeSearched” and store its row index (or name) in a variable (say “row”)
- Use WriteCell activity using “row” and “column” variables.
there’s probably a cleaner way to achieve this, but one working way is to loop through the datatable and use counters. When desired value is found save the counter as index value.
int rowCounter = 0;
foreach row in myDT.Rows
int colCounter = 0;
foreach item in row.ItemArray
if (item.ToString = “column value”)
colidx = colCounter;
colCounter = colCounter + 1;
if (item.ToString = “row value”)
rowidx = rowCounter;
rowCounter = rowCounter + 1;
This will return rowidx as an int where the desired row value was found and colidx as an int where the desired col value was found.
I am trying on that line only now.
@abskulkarni- did you get any resolution to this ? Any inputs on this will be much appreciated .