How can I write one column to an Excel file

How can I write one column from a datatable which has some columns to an Excel file .
Like this picture.xlsx (43.6 KB)

@oitot, directly use this query in write range, if you want distinct elements from that column
datatable.DefaultView.ToTable(True,“Column Name”)

If you want all values (including duplicate) make that true to false !

Dominic :slight_smile:


@oitot Refer this workflow
writeColumn.xaml (7.9 KB)

HI Dominic
I used “datatable.DefaultView.ToTable(False,“Column Name”)”. It worked !
Thanks so mush!!!

Hi Bharat.
Thanks ,it worked !

@Dominic Is it possible to specify Column index instead of Column Name?

Hi @Dominic What if we want to use column index instead of column name?

Hey @ravi007teja @MariaJosephina,

The .ToTable function accepts two arguments (also there are other overloads) which is Boolean & String()

The above example shows how to list the column names as an array. If you would like to add the column index then you can write a small snippet that will convert the array of column index that you have given into the array of column name that can be used.

Very neat - thanks Dominic.

1 Like

Thanks Bro. Saved lot of time.