How to Output DataTable to String Without the Table Header?

datatable
activities

#1

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.


#3

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:


#4

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


#5

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 !


#6

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)))


#7

editted :slight_smile:

thanks


#8

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


#9

Where exactly we need to type this in uipath?