Write Range Object reference not set Error

Hello everyone,I am getting the Write Range: Object reference not set to an instance of an object error.I searched similar topics in the forum but could not solve the issue.The process is running fine if i remove the second Write Range or put it in a Try-Catch .I see the null in my datable when debugging so maybe that’s the issue?What I want to do with this Write Range is copy the cell B2 from an excel file and paste it to cells A1:A35 of another.So far I have tried using separate excel scope with different argument name in the path and also using seperate sequence.Thank for all replies in advance.I am very new to this and would apreciate any help.


The error says the in2_dtOutput variable is null…And also from screenshot on the left locals panel I can see the datatable is empty.Please check that and give data to it



Please check you already give data to datatable,
also you can handle the error with if condition


Try to initialize the data table variable

First initialise the data table variable with
New system.data.dataTable

Then object reference error will be solved


Thanks for tour reply
Yeah that’s the problem but I cant find why.I am trying to get the data from a cell in the source excel file but all I am getting is null.The cell is not empty

Thanks for tour reply
Unfortunately that didnt solve it

Thanks for replying.
I already set it to DataTable.The in_dtOutput works fine.For some reason in2_dtOutput has the problem

Before excel application scope

Use one assign

Assign in_dtOutput as new system.data.dataTable

If you want to copy the data from B1 cell then you might use read range with B1 as cell
Then write range with A1:A35 as cell

But you have used both write range only. How it is possible to copy the data using write range.


I see in2_dtOutput is an input argument check where you are invoking it if you have passed the datatable variable from there and if the data is present there


I am reading the data as shown below.I had no problem readind and writing cells b4:f39.
I only have problem with the B2 cell.I tried assigning as you told me and I am no more getting the error message but now nothing is copying to the new excel file

Thank you for replying.I am invoking them in the main workflow


Yes Invoking is good…but from main workflow you have to pass the variable as well…click on import arguments and check if a variable is assigned and if that variable is getting data or not


Before writing it to the excel can you check if second data table as any data by using row count.

If you don’t have any data in that data table (null)
May be there is a issue while reading data to second data table

Thank you for replying.
I have already imported the arguments


The datatable youa re using is in2_dtOutput…did you assign that as well?


yes when debugging the datatable is shown as null for some reason

Can you print data table row count immediately after read range.
So you can get to know whether it is having any data or not

Yes just forgot to maximize the window and is not shown in the screenshot but I have assign it.