# Create column if it doesn't exist

**URL:** <https://community.easymorph.com/t/create-column-if-it-doesnt-exist/2776>\
**Category:** General Q&A\
**Created:** [June 2, 2021, 9:29am UTC](https://community.easymorph.com/t/create-column-if-it-doesnt-exist/2776 "2021-06-02T09:29:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ivankee](https://community.easymorph.com/letter_avatar_proxy/v4/letter/i/ecccb3/32.png) [@ivankee](https://community.easymorph.com/u/ivankee)\
**Post date:** [June 2, 2021, 9:29am UTC](https://community.easymorph.com/t/create-column-if-it-doesnt-exist/2776/1 "2021-06-02T09:29:26Z")

</div>

Hello,

I need to create a column if it doesn't exist, I saw the topic [https://community.easymorph.com/t/optional-calculations-with-columns/1221](https://community.easymorph.com/t/optional-calculations-with-columns/1221). I take the first solution with the "either table" it works but it adds complexity to implement and I don't found to make it generic (for example if I have several columns to create I need to copy again this bloc as much as I have columns)

My questions are :

- how to make this solution generic ?
- Maybe a more simple solution is possible ? (I try simply to add a new column with a if() inside but my prb is I need to export a final file without this column at the end. If the column already exists I obtain a "newColumn2" and I need to remove it in a action, therefore an error occurs if "newColumn2" doesn't exist)

---

<div class="post-metadata">

**Author:** ![dgudkov](https://community.easymorph.com/user_avatar/community.easymorph.com/dgudkov/32/5_2.png) [@dgudkov](https://community.easymorph.com/u/dgudkov)\
**Post date:** [June 3, 2021, 10:28am UTC](https://community.easymorph.com/t/create-column-if-it-doesnt-exist/2776/2 "2021-06-03T10:28:16Z")

</div>

Hi @ivankee and welcome to the Community!

I would suggest using the [2nd approach](https://community.easymorph.com/t/optional-calculations-with-columns/1221/2) as it's simpler.

If you have several column to create, you can calculate them in a separate table and append all at once with the "Append" action in the "Append columns mode". In this case, only the "Append" action will be after the "Skip" action.

> [@ivankee](#):
>
> how to make this solution generic ?

How generic it should be?

> [@ivankee](#):
>
> - Maybe a more simple solution is possible ? (I try simply to add a new column with a if() inside but my prb is I need to export a final file without this column at the end. If the column already exists I obtain a “newColumn2” and I need to remove it in a action, therefore an error occurs if “newColumn2” doesn’t exist)

Put the action that removes "newColumn2" after the "Skip" action and execute it only when "newColumn2" exists.

---

<div class="post-metadata">

**Author:** ![ivankee](https://community.easymorph.com/letter_avatar_proxy/v4/letter/i/ecccb3/32.png) [@ivankee](https://community.easymorph.com/u/ivankee)\
**Post date:** [June 4, 2021, 12:33pm UTC](https://community.easymorph.com/t/create-column-if-it-doesnt-exist/2776/3 "2021-06-04T12:33:08Z")

</div>

Thank you @dgudkov for the answer.  
Finally, I decided to use the second approach with the skip and an if columnexist("newColumn2") like you advised.

Thank you so much !

---

<div class="post-metadata">

**Author:** ![dgudkov](https://community.easymorph.com/user_avatar/community.easymorph.com/dgudkov/32/5_2.png) [@dgudkov](https://community.easymorph.com/u/dgudkov)\
**Post date:** [June 4, 2021, 5:08pm UTC](https://community.easymorph.com/t/create-column-if-it-doesnt-exist/2776/4 "2021-06-04T17:08:20Z")

</div>

You're welcome 🙂
