suggest a method to resolve it,I Want to assign 0 value if the column is empty,So suggest a proper method to get it
1.Read your excel with read range workbook activity⌠Create a variable like dt
-
Take for each row activity and pass dt as input to that
-
Inside the loop take If activity
If condition give like this
String.IsNullOrEmpty(row(âYourColumnNameâ).ToString)
Then
Assign: row(âYourColumnNameâ) = â0â
End If
This way you can add 0 to null column
Out Of the for each loop you can use the write range workbook activity to write to excel
Let me itâs working or not or you can share sample i will design work flow for youâŚ!
=> Use Read Range Workbook acitvity to read the excel and store the output in an datatable.
=> Use a âFor Each Row in DataTableâ activity to loop through each row in the DataTable.
=> Inside the loop, use an âIfâ activity to check if the specific column is empty in the current row.
If String.IsNullOrEmpty(CurrentRow("ColumnName").ToString) Then
CurrentRow("ColumnName") = "0"
End If
Replace "ColumnName"
with the name of the column you want to check.
=> After modifying the DataTable inside the loop, you can use the âWrite Rangeâ activity to write the updated DataTable back to the Excel or CSV file.
Hope it helps!!
If: Expression Activity type âVisualBasicValue`1â requires compilation in order to run. Please ensure that the workflow has been compiled. getting this error
If: Expression Activity type âVisualBasicValue`1â requires compilation in order to run. Please ensure that the workflow has been compiled. getting this
Make you to give the double quotes properly @Gopikrishna_S . Remove the double quotes and give it again. It will solve the error.
Regards
Please try this
requiredvalue = If(currentRow("ColumnName") is DBNull.Value,0,Cint(currentRow("ColumnName").ToString))
Or
currentRow("ColumnName") = If(currentRow("ColumnName") is DBNull.Value,0,Cint(currentRow("ColumnName").ToString))
Cheers
You can try this both ways
in column name i have given values but you can mention your column name
for reference you can see the output :-
let me know its working or not for you
@Gopikrishna_S
If you find solution for your query please mark it as solution to close the loop.
Happy Automation
Regards