add a new row in the beginning of a file

One Star

add a new row in the beginning of a file

Hi,
I want to add a row ( header ) to my file. it has to be in the beginning, but i'm finding it hard to do. I have more than 200 columns and some columns are integer, Date or string type. Can anyone show me how to do it ? Thanks !
Five Stars

Re: add a new row in the beginning of a file

tFileOutputDelimited has the option to 'Include Header'. There are some edge cases where this does not work well. In these instances, you can write your file twice - once for the header and once for your data, remembering to 'Append' when you write your data.
For example: -
tFixedFlowInput->tFileOutputDelimited (no header, no append) to write your header
tMySQLInput->tFileOutputDelimited(no header, append) to write your data
I would recommend 'Include Header'. If this is not working for you, what is the issue?
One Star

Re: add a new row in the beginning of a file

Thank you Tal for your quick response.
Actually, i've done some jobs on my file. During this process, i removed the header from the file because of some errors i had. Now that my jobs are done. I want to add the header again. My files are stored in cloudera. i tried creating a file were i have only my header and add the data stored in the other files into it. But it doesn't work.
One Star

Re: add a new row in the beginning of a file

Any updates on this topic?
I have a similar problem. I want to split big files to smaller ones and add a row on the very beginning of the smaller file(s).
Five Stars

Re: add a new row in the beginning of a file

tFileOutputDelimited has the option to split.
Take a look at Advanced settings->Split output in several files
Talend will manage headers for you.
One Star

Re: add a new row in the beginning of a file

Thanks or reply.
I already use this option. I want to add a first row with a different schema after splitting the file.

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch