I want to run a loop through column… Like foreach Column. How can I do that? Once I do that, I want to find the index of the column which meets my condition.
For example: I have an excel with 20 rows. In those rows, we have same column name (multiple, which I don’t need). I want to get three column - One being “Status”. So what I am planning to do is, run a loop through the column and then when it finds the string “:Status” then I want to capture that index. So I can use the same foreach row (with that index).
The reason why I am asking is, we would have lot of different excel with same column name. Wanted to get way to do this!
foreach (DataRow dtRow in dtTable.Rows)
{
// On all tables' columns
foreach(DataColumn dc in dtTable.Columns)
{
**var field1 = dtRow[dc].ToString();**
}
}
Hey @ vvaidyaMVP …My requirement is that I have to open a web url from an excel file,but the row or column is not fixed …it can be in any column eg. A,B,C,D or so on .So how solve this any ,idea? Also I have used for-each column but unable to fetch for the data in each column…so If you could help me in this would be a great help …
Thank you.
I am searching a relative topic and find your answer over here,
your workflow is very useful to me but I just have a quick question
In the “If” activity the condition is col.Tostring= “status”
But what about I want to use the specific date instead of the “status”?
For example the tile of the column is “8/1/2020” in stead of the status
And because I only want to read the value for current date, so I assign the a variable currentdate=DateTime.now.ToString(“M/01/yyyy”)
But for the “If” activity, after I change the “status” to the variable_currentdate, then it never recognize(never return me the value),
Could you please teach me how to let this robot to give the value when the title of the column changed from “status” to a variable, currentdate?