Abhilash Khajuria
Abhilash Khajuria

Reputation: 69

Mule: From Large CSV Get Header Only

I am facing issue while pulling header value CSV with a "," comma value separation. Input:

sku,Description,data
1223,"Test Description,hello",
456,"Test",

Output

sku,Description,data

I tried with,(Converting to String)

keys = payload.split('\n')[0]

but due to large size it hitting the performance. Is there a way to get first line of csv without splitting with expression component or dataweave . Initially i got org.mule.transport.file.ReceiverFileInputStream object which i converted to string.

Upvotes: 0

Views: 873

Answers (1)

Salim Khan
Salim Khan

Reputation: 4303

Try this..

%dw 2.0
output application/java
---
payload[0] pluck $$ joinBy ","

This should do the trick for you.

Upvotes: 3

Related Questions