Hi all,
I want to know if it is possible to implement this:
for each rows in the excel file, if the row is not filled up to cell 15, then fill it up with an empty string “” .
sure! so basically, the cells with alphabet are data that I have originally. There’s 15 cell in a row. And I want to fill up all the remaining cells, highlighted here, with whatever string i want.
The most important part is that the data might not be presented this way, it could be like:
You can try the following steps to get the required output:
Read a excel file using read range activity.
Use for each loop to get each row of a DataTable and create index variable in foreach activity. Note:For Each Row index variable will help to identify the row throw index value.
Use while loop activity under For Each Row. In while loop put a condition so that it run 15 times. Create index variable in while also. Note: While Loop index variable will help to identify the col throw index value.
Use If activity under the While loop and check whether the cell value is blank or not. Pass Col index variable in current row to read the cell value.
5 If the cell is blank then write the cell using write cell activity.
Before using this expression
you need to assign another dt
Dt2 = dt.Clone
(From r In dt.AsEnumerable
Let ra = r.ItemArray.Select(Function (x) If(String.IsNullOrEmpty(x.tostring),"you can give whatever string you need",x.ToString)).toArray()
Select Dt2.Rows.Add(ra)).CopyToDataTable()
It will replace all the empty value to whatever string you need