Column order problem

I have a workflow 5dcb0d8e9e94ef0007ccc557 where I’m using a data table created by a notebook.
The next step is using the “Table: get rows” node where I’m specifiying which field to use.
After that I’m using the “CSV encode” node which will later be used for an email.

The problem I’m having is the order of columns.
The output file from the notebook and the table both look correct, but the csv data shows up in a different order and I’m not sure how to fix that.

Just so I understand a bit better what the issue is - you are saying the CSV encode node is creating a CSV where the columns are not in the order you expect them to be?

Should it not keep the order?

If you are using the Object Keys option for CSV headers the columns are not guaranteed to be in a specific order (due to the fact that objects don’t have an inherent order). If you want a guaranteed specific order, you will want to use either the Individual Fields or the Payload Path options for setting up the headers for your CSV.