How to paste data without column headers?

I am converting a dataset to datatable and then converting that datatable to string using the output datatable activity,

Problem is column headers are also getting pasted like this

Is there a way to avoid those column headers ? (Column headers are OUR_REF, PRINCIPAL_NAME etc etc i.e which are in the first line )

Hi @Ishan_Shelke

While save datatable into Excel skip the add header options. It will write only the values in excel

Thanks!!!

HI @Ishan_Shelke

You can keep as it as Data table and use this LINQ expression

Use Assign activity

DtOutput = YourInputDT.AsEnumerable().Skip(1).CopyToDataTable

After that use Output Data Table

Data Table -> DtOutput 

Result -> OutString

Paste the data as you need.

Regards
Gokul

Hi @Ishan_Shelke

Please use this in assign

String.Join(",",Dt.AsEnumerable.Select(function(x) string.Join(",",x.itemarray)))

Cheers

as it is generated by the output of this activity you do have following options:

  • remove first line afterwards from the output datatable result
  • OR construct the CSV by your self e.g. LINQ
FilteredLines = strOutputDatatableResult.Split({Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries).Skip(1).ToArray
strCSVWithoutHeader = String.Join(Environment.NewLine},FilteredLines )

This is little bit manipulating my output,

Previously :

image

After applying the above assign :

image

This is making some of my numbers unrecognizable as you can see, the numbers which are in Inverted commas I want to treat them differently. Doing this, is making my numbers inconsistent

@Ishan_Shelke

May I know what do you mean inconsistent? …you want the values to be surrounded by quotes? If so use like this

String.Join(",",Dt.AsEnumerable.Select(function(x) string.Join(""",""",x.itemarray)))

Hi @Gokul001

I guess this will skip the first row of the data table, not the column headers

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.