Excel file using write range workbook

Hi,

I am facing this issue when I try to write on excel file using the “write range workbook”
the previous step is appending data using the “add data row” activity and then written onto the excel file.
here the screenshot of the error
image

Hi @Jyothi31

Can you show the workflow screenshot or Try with Excel activities

Regards,

I hope this would be helpful

@Jyothi31,

This happens when your Datatable have null value in some column.

Get the data fixed using this code first and then use Write Range .

(From r In dtData.AsEnumerable
let ra = r.ItemArray.Select(Function (x) If(isNothing(x) OrElse String.IsNullOrEmpty(x.ToString.Trim), DBNull.Value, x)).toArray
Select dtCorrected.Rows.Add(ra)).CopyToDataTable()

Taken from this thread.

is there any other possible solution?
I’m unable to fix the above solution in my workflow! Also the above solution should be added after the build data table activity and above add data row right?

Thanks in Advance

@Jyothi31

Can you please share sample input and expected output

Regards,

Sample input is having all the columns and one default row with zeroes filled in columns
sample output contains the actual data after the add data row activity is done.

And also, after adding the above code before the write range activity I get this error
image

@Jyothi31,

Add this in Assign activity before the LINQ code

dtCorrected = OriginDataTableVar.Clone()

I did that after the build data table activity.

thanks in advance

this is the current flow is there something i am doing wrong or missing out

@Jyothi31,

LINQ query should be on your output datatable

Here it should from r in output
The table name here is DtCorrect
Change the table name as suggested in previous reply