# Сannot replace a column with a column with the same name

**URL:** <https://community.datagrok.ai/t/annot-replace-a-column-with-a-column-with-the-same-name/528>\
**Category:** Issues\
**Created:** [March 23, 2021, 3:55pm UTC](https://community.datagrok.ai/t/annot-replace-a-column-with-a-column-with-the-same-name/528 "2021-03-23T15:55:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![olesia.nefedova](https://community.datagrok.ai/letter_avatar_proxy/v4/letter/o/a8b319/32.png) [@olesia.nefedova](https://community.datagrok.ai/u/olesia.nefedova)\
**Post date:** [March 23, 2021, 3:55pm UTC](https://community.datagrok.ai/t/annot-replace-a-column-with-a-column-with-the-same-name/528/1 "2021-03-23T15:55:59Z")

</div>

When I try to use the method `replace(columnToReplace, newColumn)` and want to replace one column with another with the same name, an error appears:

Uncaught Invalid argument(s): Column named ‘test 1’ already exists

---

<div class="post-metadata">

**Author:** ![alex.paramonov](https://community.datagrok.ai/user_avatar/community.datagrok.ai/alex.paramonov/32/9_2.png) [@alex.paramonov](https://community.datagrok.ai/u/alex.paramonov)\
**Post date:** [March 23, 2021, 6:59pm UTC](https://community.datagrok.ai/t/annot-replace-a-column-with-a-column-with-the-same-name/528/2 "2021-03-23T18:59:56Z")

</div>

Hi Olesia, thanks for reporting! I will fix it.

---

<div class="post-metadata">

**Author:** ![aydar.akhmetov](https://community.datagrok.ai/user_avatar/community.datagrok.ai/aydar.akhmetov/32/221_2.png) [@aydar.akhmetov](https://community.datagrok.ai/u/aydar.akhmetov)\
**Post date:** [June 14, 2021, 7:26am UTC](https://community.datagrok.ai/t/annot-replace-a-column-with-a-column-with-the-same-name/528/3 "2021-06-14T07:26:37Z")

</div>

Hi Olesia! Can’t reproduce the error. Could you provide an example where this error occurs when you are using the replace function?

---

<div class="post-metadata">

**Author:** ![olesia.nefedova](https://community.datagrok.ai/letter_avatar_proxy/v4/letter/o/a8b319/32.png) [@olesia.nefedova](https://community.datagrok.ai/u/olesia.nefedova)\
**Post date:** [June 15, 2021, 7:22am UTC](https://community.datagrok.ai/t/annot-replace-a-column-with-a-column-with-the-same-name/528/4 "2021-06-15T07:22:01Z")

</div>

Hi Aydar, sure!

Steps to reproduce:

Create a column using any of the structureSearch methods (similarity, substructure). Give it a name and add it to the table.  
Create another column using any of the structureSearch methods (similarity, substructure). Give it exactly the same name as the first time and use the replace method.

Result: an error occurs that a column with the same name already exists.

---

<div class="post-metadata">

**Author:** ![aydar.akhmetov](https://community.datagrok.ai/user_avatar/community.datagrok.ai/aydar.akhmetov/32/221_2.png) [@aydar.akhmetov](https://community.datagrok.ai/u/aydar.akhmetov)\
**Post date:** [June 17, 2021, 12:19pm UTC](https://community.datagrok.ai/t/annot-replace-a-column-with-a-column-with-the-same-name/528/5 "2021-06-17T12:19:38Z")

</div>

Thank you, Olesia! We’ve fixed the behavior of the column replace method. Check, please, if there are still any problems with this function.
