I need to update the excel cells that meet certain conditions, for example, I have the code column and the batch column, if the value of the code column is equal to “CM84” and the value of the batch column begins with “CM” I need that the value of the code column changes and is “CM28”
I solved this with a for each in data table, but due to the amount of data that I have in the file it is not the best solution, that is why I am trying to solve it with a linq
Hello, thank you very much, I had already seen these posts, but in the first one that you shared with me I have not been able to change only column B, that script always changes column C and only selects columns from A to D, I need that the file remains intact and only the cells that meet the conditions are changed (the file contains about 50 columns)
LINQ doesn’t avoid looping. It still loops inside the LINQ engine. It’s a myth that LINQ is faster. In fact, LINQ can be slower because it introduces more overhead.
(From r In DT_Data.AsEnumerable Let ra = r.ItemArray.Select(Function (x) x.ToString.Trim.Replace(" ",“NA”)).toArray() Select DT_Data.Rows.Add(ra)).CopyToDataTable()