CSV Write generates a comma-separated string with the input payload as input. It is not meant to create CSV files for further processing as writing the output to a file will not append, but overwrite it. If you want to populate a CSV file appending new lines of data after every incoming sensor data, you can use the File Write component and follow the example there.
The input payload can be an array of JSON arrays or an array of JSON objects. Otherwise, it will be converted to a string and output as a CSV with one line and one column.

Input Payload Example
JSON array payload example [[123, “abc”, “xxx”], [456, “def”, “yyy”], [789, “hij”, “zzz”]]
JSON Object payload example [{field1, “field2”:“abc”, “field3”:“xxx”}, {field1, “field2”:“def”, “field3”:“yyy”}, {field1, “field2”:“hij”, “field3”:“zzz”}]

The “Output” property allows you to select the output destination as file or payload.

Output payload Description
When you choose “File” for the “Output Destination” property The generated CSV is written to a file and the output payload passes the input payload. (Pass-through.)
When you choose “Payload” for the “Output to” property Put the generated CSV byte sequence into the output payload.

Component Properties

Name Required Description
Output True Specify either File or Payload as the output destination. cp.Output is set to either “Payload” or “File”.
Filename False Specify the file name for file output
Encoding False Specify the encoding of the file output

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.