Fill blank data with '-'

Hello All,
I have few excel files which has almost 200 lines of data each, with some blank cells as well…
when I am consolidating them into one, the rows which has even one blank cell is not getting consolidated. So, the whole row is getting removed.

So, I want to put either “-” or a “0” into those blank cells automatically before consolidation… !
Thanks…

1 Like

Hi

Check this thread for a xaml sample on the same note

Cheers @Pranay_Kumar_Bose

@Pranay_Kumar_Bose

You can use find/replace activity and replace all the blanks with -

cheers

Hello @Pranay_Kumar_Bose

Assign (ConsolidatedDataTable = New DataTable)

ForEach (ExcelFilePath in ListOfExcelFiles)

Excel Application Scope (Specify ExcelFilePath)

Read Range (Read data into DataTable)

Loop through rows and columns in the DataTable
ForEach (Row in DataTable.Rows)

ForEach (Cell in Row.ItemArray)

If (String.IsNullOrEmpty(Cell.ToString()))

Replace blank cell with “-” or “0”
Modify the logic based on your requirements
Cell = “-”

Append DataTable to ConsolidatedDataTable
Merge DataTable (Source: DataTable, Destination: ConsolidatedDataTable)

Write ConsolidatedDataTable to the output Excel file
Excel Application Scope (Specify OutputExcelFilePath)

Write Range (ConsolidatedDataTable)

Thanks & Cheers!!!