Excel & Datatable doubt

Hi Team,

I am trying to do datatable program. When I ran getting error in the For Each Row block.

-----19.6.0+Branch.master.Sha.adf20656f41da84cdec5e5620b62276717eb7319

Source: For Each Row

Message: Object reference not set to an instance of an object.

Exception Type: System.NullReferenceException

RemoteException wrapping System.NullReferenceException: Object reference not set to an instance of an object.
at UiPath.Core.Activities.ForEach`1.Execute(NativeActivityContext context)
at System.Activities.NativeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)-------

Please find the attached xaml & excel file for your reference.

Main.xaml (18.9 KB)

P1-SuperStoreUS-2015.xlsx (350.9 KB)

Kindly help me on this and correct me where I went wrong.

Thanks in advance!

Regards,
Hari

Hi @Hariprasad

Check is there any column name or value missing in Excel

Thanks
Ashwin.S

Hi @Hariprasad,

‘Object reference not set to an instance of an object.’ means that some of the value that you are passing is null. Please check if you have declared correct datatable variable in for each loop.

BR,
Chaitanya

@Hariprasad buddy actually you gave the output of read range as readDT whereas in for each you gave it as readdt plz change it.

@venkatmalla6

Noticed and changed buddy! but still the same error…

@Hariprasad it worked for me plz have a lookMain (2).xaml (19.9 KB) i just deleted the variable now it works.

1 Like

@Hariprasad did it works buddy

@venkatmalla6 May i know which variable you have deleted?

Also noticed that the activities are commented out which are not in use with current project.
My ques–> Is that a good practice to comment it out?

@Hariprasad yeah buddy i deleted the readdt variable which you used at for each and i commented out which are not in use,yeah it is always good practice to comment out or delete the activities which are not in use.

2 Likes

@venkatmalla6 You are great! Followed you steps and got the output.
Thank you Genius :star_struck:

@Hariprasad that’s great, mark it as solution so that it would be helpful to others.

Hello
I have created process for Client Security hash without using Reframework. But I am having issue “Object reference not set to an instance of an object. at UiPath.Core.Activities.ForEach`1.Execute(NativeActivityContext context) at System.Activities.NativeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor in uipath” in for loop inside the Process Transaction for in_FilteredData while running and debugging process. I tried to debug the process but I am getting same issue. I also used the Try catch block, but same issue. I am attaching workflow, excel file and error screenshot.
Please tell me the resolution of the issue and fix the issue.

Thanks and Regards
Rohit Lanjewar

Main.xaml (6.6 KB)
DemoCalculateClientSecurityHash.zip (367.8 KB)