I have a dataset of 15 columns. I want to generate an excel sheet with only 4 columns of that dataset. How can we select a subset of columns in to a datatable? Thanks, Rohit
You can use DefaultView.ToTable
for this:
var table = table.DefaultView.ToTable(false, "Column1", "Column2", "Column3");
Here's the documentation: DefaultView.ToTable Method
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With