How to Output DataTable to String Without the Table Header?

Hello, I’d like to write a datatable to a text file, and is using Output Data Table.
But I need to output it without the table header.
Is there any way to do it, or to go around it?

(I want to avoid using loop if possible, as the data now is very big).

The normal Output DataTable:
“ColumnName1,ColumnName2
A1, B1
A2, B2”

Expected result:
“A1, B1
A2, B2”

Thank you in advance.

1 Like

just type this in the log:

string.join(Environment.NewLine, yourDataTable.Rows.Cast(of DataRow).Select(function(row) string.Join(",",row.itemArray)))

If still appears add .skip(1) before .select

I wish it helps and dont hesitate to mark it as a solution if it works… :slight_smile:

5 Likes

@whyyouandi If you are reading from excel Read Range Actvity properties->check AddHeaders

1 Like

Hello @NivedithaK, I found the solution already. Thank you!

Hi @indra, seems I was not making myself clear, I wanted to remove the header :wink:
But found the solution already, thank you !

1 Like

Thank you @Ignacio_Insua_Feito, it worked well!
If anyone came across to this post in the future, please add one more ) so the code should be:
String.Join(Environment.NewLine, yourDataTable.Rows.Cast(of DataRow).Select(Function(row) String.Join(",",row.itemArray)))

1 Like

editted :slight_smile:

thanks

1 Like

string.Join(environment.NewLine,from m in testTable.Select select string.Join(",",m.ItemArray))
you can have a try.

2 Likes

Where exactly we need to type this in uipath?

1 Like