# Stuck on copying one column data to another

**URL:** <https://connect.superhuman.com/t/stuck-on-copying-one-column-data-to-another/51600>\
**Category:** Ask the Community\
**Created:** [October 10, 2024, 11:16pm UTC](https://connect.superhuman.com/t/stuck-on-copying-one-column-data-to-another/51600 "2024-10-10T23:16:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mattics](https://avatars.discourse-cdn.com/v4/letter/m/eada6e/32.png) [@mattics](https://connect.superhuman.com/u/mattics)\
**Post date:** [October 10, 2024, 11:16pm UTC](https://connect.superhuman.com/t/stuck-on-copying-one-column-data-to-another/51600/1 "2024-10-10T23:16:04Z")

</div>

Hi! I thought this part was easy but apparently, it is not. How can I copy one column data to another column? Below is the formula I have with a button but it it copies just one value in the entire column. Here is my [sheet](https://coda.io/d/Copy-column-data_dGNq6oOUtF9/Copy-column-data_suK2S2_U#_lu9bZtvk), you might need to request access to the sheet.

```auto
[Projects].Foreach(
    ModifyRows(
      [Projects],
      CurrentValue.[Previous priority],
      CurrentValue.Priority
    )
)

```

---

<div class="post-metadata">

**Author:** ![Daragh\_O\_Shea1](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/daragh_o_shea1/32/43791_2.png) [@Daragh\_O\_Shea1](https://connect.superhuman.com/u/Daragh_O_Shea1)\
**Post date:** [October 11, 2024, 7:05am UTC](https://connect.superhuman.com/t/stuck-on-copying-one-column-data-to-another/51600/2 "2024-10-11T07:05:48Z")

</div>

This should work, assuming you want to populate the `[Previous Priority]` column with the `[Priority]` columns value.

You can write it as

```auto
[Projects].Foreach(
    CurrentValue.ModifyRows(
     [Previous priority],
      CurrentValue.Priority
    )
)

```

The first item to pass to the `ModifyRows` using this approach is the name of the column, the second item is the value to set the column.

---

<div class="post-metadata">

**Author:** ![mattics](https://avatars.discourse-cdn.com/v4/letter/m/eada6e/32.png) [@mattics](https://connect.superhuman.com/u/mattics)\
**Post date:** [October 11, 2024, 3:05pm UTC](https://connect.superhuman.com/t/stuck-on-copying-one-column-data-to-another/51600/3 "2024-10-11T15:05:01Z")

</div>

wow thanks @Daragh_O_Shea1 ! It works! Can I ask why you did CurrentValue.ModifyRows? The foreach already iterates through each item , why did you need to prepend CurrentValue to it as well?

---

<div class="post-metadata">

**Author:** ![Daragh\_O\_Shea1](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/daragh_o_shea1/32/43791_2.png) [@Daragh\_O\_Shea1](https://connect.superhuman.com/u/Daragh_O_Shea1)\
**Post date:** [October 13, 2024, 7:52pm UTC](https://connect.superhuman.com/t/stuck-on-copying-one-column-data-to-another/51600/4 "2024-10-13T19:52:32Z")

</div>

In a ForEach loop on a table like this, CurrentValue is the current table `row` in the loop

Prepending the formula is just a different way to write it. It could also be written like this:

```auto
Projects].Foreach(
   ModifyRows(
     CurrentValue,
     [Previous priority],
      CurrentValue.Priority
    )
)

```

Each row is being updated individually in the loop

---

<div class="post-metadata">

**Author:** ![mattics](https://avatars.discourse-cdn.com/v4/letter/m/eada6e/32.png) [@mattics](https://connect.superhuman.com/u/mattics)\
**Post date:** [October 14, 2024, 7:24pm UTC](https://connect.superhuman.com/t/stuck-on-copying-one-column-data-to-another/51600/5 "2024-10-14T19:24:13Z")

</div>

Thank you for the explanation! I reread the definition of ModifyRows and I did see that the first input was a row, not a table. 🙂 Cheers!

---

<div class="post-metadata">

**Author:** ![system](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/system/32/24484_2.png) [@system](https://connect.superhuman.com/u/system)\
**Post date:** [October 17, 2024, 7:25pm UTC](https://connect.superhuman.com/t/stuck-on-copying-one-column-data-to-another/51600/6 "2024-10-17T19:25:03Z")

</div>

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
