Support Questions
Find answers, ask questions, and share your expertise

How to Extract only header of a csv file in NiFi ?

New Contributor

which processor can be used to extract(read) only the header( 1st row of the file) of a csv file.


Expert Contributor

New Contributor

why do we need ReplaceText processor here, could you please explain?  .I just want to extract the header (1st row) . and do not want to replace the header with any other text.

Rising Star


Once you extracted the header into Flowfile attribute using ExtractText processor, next you are going to convert the header flowfile attribute  into Flow file content OR you can keep the header value as in attribute ..The stack overflow explains about extracting header into flowfile attribute and next they have pass the headers as file into destination .To convert flowfile attribute to file/flowfile content ,we will have to use ReplaceText processor where you can pass flowfile attributes .. The success relationship of ReplaceText will only contains header in flowfile content and the original csv file will be replaced with header as content . The flowfile content, you can transfer to destination or next processor in the flow.


Hope this information you are looking for ..



; ;