I have text file that was created using the Append line within a for each loop. This is my text file
a;23;k;
b;100;C;
c;11;D;
However, I want to add a header to the text file, so it looks like this
$E123;my new cat;B;22AA2;
a;23;k;
b;100;C;
c;11;D;
The use case in Combine txt files keeping 1 header row? did not fully apply to mine. Ideas will be appreciated.
lrtetala
(Lakshman Reddy)
October 10, 2023, 4:15pm
2
Hi @Yomi_Oluwadara
You can try this
BlankProcess13.zip (40.3 KB)
Hope this helps!!
supriya117
(Supriya Allada)
October 10, 2023, 4:21pm
3
Hi @Yomi_Oluwadara
str_columns = string.Join(";",yourDatatable.Columns.Cast(Of DataColumn)().Select(Function(column) column.ColumnName).ToArray())
Use write text file or append line activity to write this str_column string to text file before for each
Hope it helps.
lrtetala
(Lakshman Reddy)
October 10, 2023, 4:21pm
4
@Yomi_Oluwadara
1.Use Read Text File activity and Output variable as **TextFile**
2.Assign: Header= "$E123;my new cat;B;22AA2;"
3.TextFile=Header & Environment.NewLine & TextFile
4.Use Write Text File activity
O/P:
@lrtetala it worked! thanks
@supriya117 Thanks !
1 Like
system
(system)
Closed
October 13, 2023, 4:34pm
6
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.