Writing Specific Columns from Output Datatable

I have extracted some data and put in a output data table. I want to only write columns 2 and 3 to a specific sheet in a excel worksheet. How would I do this?

Thanks!

Hi @Pranav_KomandurPK

Please try this,

dtTable - datatable

dtTable = dtTable.defaultview.totable(false,“Column-2”,“Column-3”)

Thanks

1 Like

Where would I put this statement?

Thanks

@Pranav_KomandurPK you can put in the write range itself. and also change dttable with your extracted datatable.

Thanks

1 Like

It gives this error

@Pranav_KomandurPK please try this

ExtractdataTable.defaultview.totable(false,ExtractdataTable.columns(1).columnname,ExtractdataTable.columns(2).columnname)

Thanks

1 Like

Giving me this error

Thanks

@Pranav_KomandurPK did the scrapped data has headers.

Please try Extractdatatable.coulmns.count.tostring in messagebox and see if it has any headers.

Thanks

Hi @Pranav_KomandurPK ,

You can use Linq to achieve this.
Check the solution and let me know if you face any issue.
MyLinq.zip (9.6 KB)