Conversion from type 'DBNull' to type 'Integer' is not valid

Output.zip (58.4 KB)
Hi All,

I need help with the excel calculation.

I have almost done can anyone please help me find solutions for this total issue.

Here is my final report(Report-20210731213800.xlsx) I trying to print the total value at the D6 column it should sum of D2 to D5 = “2544” I added the same way for column “C” and column “D” it’s working fine, but column D not working. (Report-20210731213800.xlsx)

When am trying to convert I got an error as Assign: Conversion from type ‘DBNull’ to type ‘Integer’ is not valid.

Seems error saying “my data table has some null value”, but, I’ve data in the excel file there is NO NUll value refer D2 to D5 “Report-20210731213800.xlsx”

Can any one help me for this. I’ve attached flow.

@Shagoul_Hameed - Are you trying this in Studio or StudioX??

image

If Studio, please change the category.

Assuming you’re using Studio, not StudioX, if you debug the code you should see that the fourth column doesn’t have any data.

This is your datatable at the last step when you access CurrentRow(3)
image

Fix that and you should be good to go

1 Like

it’s studio

thanks for checking

Am capture this column D value from column B and C it as some calculation refer below.
image
image

If I’ve only formula then how to I add calculation from the data table column D
Please advise

got solution thank you all
image

1 Like

@Shagoul_Hameed
Glad that you got the solution to your problem.

I have a suggestion that might make your life easier.
Since you’re reading the Excel into your UiPath code, you don’t need to use Excel formulas in Write Cell activity.

While inside For Each Row loop, you can do something like -
Assign -> Data4Value = CInt(CurrentRow("DATA3")) - CInt(CurrentRow("DATA3"))
Write Cell -> Data4Value

CInt = Cast to Integer (This code casts the value to an integer).
CurrentRow will automatically increment the row number, so you won’t have to use
"D" + "<complex logic to find column>"

Personally I find it easier to completely update my datatable, and write it back to the same sheet in one go. This way I can avoid tedious implementation of Write Cell activity.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.