Skip to main content

Notifications

Community site session details

Community site session details

Session Id : n8mxzOKJvkmig8/LMj7eHJ
Power Apps - Building Power Apps
Unanswered

AddColumns error - Column name already exists

Like (0) ShareShare
ReportReport
Posted on 13 Apr 2023 08:11:19 by 49

I am trying to add some columns to a collection using the AddColumns function. The second argument - Column Name - returns the error: "Column name already exists".

It has started happening recently. Previously the same code was working fine.

Here is the syntax:

Clearcollect(col_bills, AddColumns(Gallery.AllItems,"NewColumn", "TestVal"))

  • iAm_ManCat Profile Picture
    18,206 Most Valuable Professional on 13 Apr 2023 at 13:27:41
    Re: AddColumns error - Column name already exists

    @sahana_23 That is not a valid Power Apps formula, the column name has to be a text literal - plus even if you could add a random value to the column name after every time you collect something, then you will never be able to refer to that column name in your App as it will change every time

     

    Did you try this formula yourself or is this what the AI suggested - AI models are currently particularly bad at PowerFx, so I would not recommend using them for PowerFx

  • sahana_23 Profile Picture
    46 on 13 Apr 2023 at 10:54:00
    Re: AddColumns error - Column name already exists

    Hii, Can you use this formula and try it once,

    ClearCollect(col_bills, AddColumns(Gallery.AllItems,"NewColumn" & Text(Rand()), "TestVal"))

  • victorcp Profile Picture
    2,347 Super User 2025 Season 1 on 13 Apr 2023 at 09:20:50
    Re: AddColumns error - Column name already exists

    Hi,

    Problably you already have that column, if you want to override it, you can do this:

    ClearCollect(col_bills, AddColumns(DropColumns(Gallery.AllItems,"NewColumn"),"NewColumn", "TestVal"))

    But I suggest changing the name of NewColumn.

     

    I hope it helps 🙂

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,780 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,093 Most Valuable Professional

Leaderboard
Loading started