How to add headers to CSV file

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to add headers to CSV file

mayank rathi
Hello All,

I am working on a NiFi flow to read data from a database and dump it into a
CSV file.

I will use ExecuteSQL to read data and PutFile to generate CSV file.

Which processor can I use to add header to this CSV file?

Thanks in advance
MR

--
NOTICE: This email message is for the sole use of the intended recipient(s)
and may contain confidential and privileged information. Any unauthorized
review, use, disclosure or distribution is prohibited. If you are not the
intended recipient, please contact the sender by reply email and destroy
all copies of the original message.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to add headers to CSV file

Mark Payne
Hello,

You should be able to do this with ReplaceText, using a Replacement Strategy
of Prepend. The Replacement Value would then be the header that you want to add to the
beginning of the file.

Thanks
-Mark


> On Aug 2, 2017, at 3:36 AM, mayank rathi <[hidden email]> wrote:
>
> Hello All,
>
> I am working on a NiFi flow to read data from a database and dump it into a
> CSV file.
>
> I will use ExecuteSQL to read data and PutFile to generate CSV file.
>
> Which processor can I use to add header to this CSV file?
>
> Thanks in advance
> MR
>
> --
> NOTICE: This email message is for the sole use of the intended recipient(s)
> and may contain confidential and privileged information. Any unauthorized
> review, use, disclosure or distribution is prohibited. If you are not the
> intended recipient, please contact the sender by reply email and destroy
> all copies of the original message.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to add headers to CSV file

mayank rathi
Thanks Mark. I am almost there.

Text in Flow file: ZYZ    TF9y<z
Replace Text in ReplaceText processor : alpha,beta,gamma

Output is : alpha,beta,gammaZYZ    TF9y<z

Required Output ( Header and Text on different lines):
alpha,beta,gamma
ZYZ    TF9y<z

How can I get required output? I tried Shift+Enter in Replace Text but it
did not work.

Thanks and Regards
MR


On Wed, Aug 2, 2017 at 8:31 AM, Mark Payne <[hidden email]> wrote:

> Hello,
>
> You should be able to do this with ReplaceText, using a Replacement
> Strategy
> of Prepend. The Replacement Value would then be the header that you want
> to add to the
> beginning of the file.
>
> Thanks
> -Mark
>
>
> > On Aug 2, 2017, at 3:36 AM, mayank rathi <[hidden email]> wrote:
> >
> > Hello All,
> >
> > I am working on a NiFi flow to read data from a database and dump it
> into a
> > CSV file.
> >
> > I will use ExecuteSQL to read data and PutFile to generate CSV file.
> >
> > Which processor can I use to add header to this CSV file?
> >
> > Thanks in advance
> > MR
> >
> > --
> > NOTICE: This email message is for the sole use of the intended
> recipient(s)
> > and may contain confidential and privileged information. Any unauthorized
> > review, use, disclosure or distribution is prohibited. If you are not the
> > intended recipient, please contact the sender by reply email and destroy
> > all copies of the original message.
>
>


--
NOTICE: This email message is for the sole use of the intended recipient(s)
and may contain confidential and privileged information. Any unauthorized
review, use, disclosure or distribution is prohibited. If you are not the
intended recipient, please contact the sender by reply email and destroy
all copies of the original message.
Loading...