How can i write excel with data array

datatable
excel
activities

#1

I am having some data in data array variable “system.data.datarow[]” how can i write this data into excel file


#2

@thangapandian, convert it to a data table

DataRow[].CopyToDatatable

Regards,
Dominic :slight_smile:


#3

thank you


#4

Hi @Dominic,

my problem is that I have a DataTable which contains all the data in excel sheet so I want to convert it to DataRow[], is this possible?Please help


#5

HI @siahVudu,
you can use like “dtTable.Select()” . It will return the datarow array.

Regards
Balamurugan


#6

Thank you so much for quick reply,it worked:slightly_smiling_face:


#7

Alongwith balu’s solution, dt.AsEnumerable() can also be used.

Edit: Remember that above will return System.Data.EnumerbaleRowCollection(of System.Data.DataRow). .ToArray is essential to be converted into Datarow array


#8

@Dominic,Thank you that also works