Reading random Values in excel

Hi @devasaiprasad_K ,

Asssuming that you are expecting three columns in the output, modify the logic and give this a try:

(From row In dt_data.AsEnumerable()
Let ra = row.ItemArray.Where(Function(w) Not(IsNothing(w) OrElse String.IsNullOrEmpty(w.ToString))).ToArray()
Select dt_res.Rows.Add(ra)).CopyToDataTable()

This works if there are only three items with values in a given row i.e., if there are 6 columns with 3 empty cells and 3 cells populated with data, this logic works.

CompressLastColumnv2.xaml (12.3 KB)

Kind Regards,
Ashwin A.K

|TheCodingTheory|

1 Like