Cannot utilize write cell in for each loop

Hi all!

I am trying to write to column E and F for each row in a loop.

It works when my condition is true and my IF is triggered, but when the condition is not true, I get the error below.

It is as if the rowindex is not found. Any help would be appreciated, thank you.


Source: Write Cell

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

Exception Type: System.NullReferenceException

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.NullReferenceException: Object reference not set to an instance of an object.
at UiPath.Executor.WorkflowRunner.EndExecute(IAsyncResult result)
at UiPath.Core.Activities.InvokeWorkflowFile.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)


buddy kindly check whether any value for rowindex is passed with NULL value or without any value when it goes to this write cell
If it doesn’t have any value with it this error occured because of that only
Cheers @ChrisPals

Hi @Palaniyappan

Thank you for the answer.

How do you propose if its null? I tried with a message box before the excel scope, and it gave the same error.

Buddy make sure that rowIndex variable is created with a default value of 0 in the variable panel and once after the write cell try to increment the value of rowIndex with a assign activity like this
rowIndex = rowIndex + 1
to make sure that the next write cell will write in next cell of the column
CHeers @ChrisPals

Hi @Palaniyappan

I am sorry, But it didnt work. Could I maybe show you my workflow and then you might be able to recognize the issue.

yes of course buddy @ChrisPals
kindly send them

hi buddy
are you there
Cheers @ChrisPals

yeah whats up