Hello, I am fairly new to UiPath but experimenting with a solution that reads multiple cell values from a workbook and writes the values to an application. I have already built a solution that is able to do that if all the cells of the excel workbook are populated. But as soon as the code comes across a blank cell with no value/null value the solution breaks and does not continue further.
I looking for a way that does not throw error when it encounters an empty cell.
I need something that will let read the excel workbook and write the values from cells in an application, but if it comes across an empty cell it will skip that writing process and go onto the next cell.
I tried enabling continue on error through the activities property window but that’s not an ideal solution. I would really appreciate any feedback from the community on this topic.
Inside the For Each Row loop, use an If activity to check if a specific cell in the row is empty or null. You can use the String.IsNullOrWhiteSpace function to check for empty or whitespace-only values.
If Not String.IsNullOrWhiteSpace(row("Column1").ToString)
Then continue the process
If you have more number of columns, it might be hard to check every column cell then try this approach:
<For Each dt> (Loop through the DataTable)
<For Each dt.Columns> (Loop through all the columns in the row)
<Assign Activity> (Assign the current cell value to a variable)
<If Activity> (Check if the cell is not empty or not null)
Condition: Not String.IsNullOrWhiteSpace(cellValue.ToString)
Then:
<Write to Application> (Write the cell value to the application)
Could you let us know what is used for Reading the Excel sheet or Cell ? We might be able to perform the correction in your code itself if there is minor correction to be done.
Let us know what is the implementation done from your end to help further and if possible try to correct the existing implementation.
Thanks for providing with an example. I tried your method but the code is skipping entire row instead of just the empty column. For reference there are multiple columns but if there are values in one of the columns then we need to write the values from that column to the application but if in the same row if there is an empty cell, we just need to skip that cell and carry on with the rest of the cells.
Thanks for the reply. I tried your suggested method but the code is skipping entire row instead of just the empty column. For reference there are multiple columns but if there are values in one of the columns then we need to write the values from that column to the application but if in the same row if there is an empty cell, we just need to skip that cell and carry on with the rest of the cells.
Thanks for the reply. Your right, there are multiple columns. For reference there are multiple columns but if there are values in one of the columns then we need to write the values from that column to the application but if in the same row if there is an empty cell, we just need to skip that cell and carry on with the rest of the cells.
Do you provide me a screenshot of the tool used to write the above code, and is that code still valid for the scenario I descried.