# Custom CSV Headers

**URL:** <https://forums.losant.com/t/custom-csv-headers/4912>\
**Category:** Help\
**Tags:** experience, workflow\
**Created:** [January 30, 2023, 7:33pm UTC](https://forums.losant.com/t/custom-csv-headers/4912 "2023-01-30T19:33:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Huckfeldt](https://avatars.discourse-cdn.com/v4/letter/p/ed655f/32.png) [@Paul\_Huckfeldt](https://forums.losant.com/u/Paul_Huckfeldt)\
**Post date:** [January 30, 2023, 7:33pm UTC](https://forums.losant.com/t/custom-csv-headers/4912/1 "2023-01-30T19:33:37Z")

</div>

Context: the data I want to export to a csv has attributes, that are named for internal use. So in the headers different Strings should be displayed.  
When using the CSV: Encode Node object keys that are not part of the headers will be excluded.  
[CSV: Encode Node | Losant Documentation](https://docs.losant.com/workflows/logic/csv-encode/)  
It seems to me that I need to decide (when using the CSV: Encode Node) if I either want to have the complete data or the desired headers.

Example  
Attributes : [“fruitWeight”, “fruitColor”, “price”]  
Desired Headers : [“Fruit Weight”, “Fruit Color”, “Price”]

Is there a smart way to accomplish custom headers (that are different than the object keys)?

---

<div class="post-metadata">

**Author:** ![Sebastian\_Turner](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/sebastian_turner/32/4024_2.png) [@Sebastian\_Turner](https://forums.losant.com/u/Sebastian_Turner)\
**Post date:** [January 30, 2023, 9:31pm UTC](https://forums.losant.com/t/custom-csv-headers/4912/2 "2023-01-30T21:31:30Z")

</div>

Our recommendation would be to use the [Function Node](https://docs.losant.com/workflows/logic/function/) to replace the object keys before encoding

There are several different ways to go about it. I’ll work on an example and get back to this thread shortly.

---

<div class="post-metadata">

**Author:** ![Sebastian\_Turner](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/sebastian_turner/32/4024_2.png) [@Sebastian\_Turner](https://forums.losant.com/u/Sebastian_Turner)\
**Post date:** [February 1, 2023, 9:44pm UTC](https://forums.losant.com/t/custom-csv-headers/4912/3 "2023-02-01T21:44:49Z")

</div>

To follow up on this, I’ve attached a workflow file that gives a very basic example of using the Function node to replace object keys.

Given an array (`data.fruitData`) with object keys [“fruitColor”, “fruitPrice”, “fruitWeight”], we use this in the Function node:

```auto
payload.data.fruitDataNew = payload.data.fruitData.map((v) => {
  return {
    'Fruit Color': v.fruitColor,
    'Fruit Price': v.fruitPrice,
    'Fruit Weight': v.fruitWeight
  };
})

```

This will obviously need to be built upon for your use-case, but please let us know if this helps get you to where you need to be.

[fruit-data-csv-develop.flow](https://forums.losant.com/uploads/short-url/bQ4reNpfjKOeIv5VBj0uWWu3JDd.flow) (2.5 KB)
