web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Adding Rows to Exel
Power Apps
Answered

Adding Rows to Exel

(0) ShareShare
ReportReport
Posted on by 4
Hi All, 
 
Im currently working on a PowerApp where you can choose an Order and to that Order you can add the Materials needed. when the Materials are added (stored in a Collection)
you can push a button and save the entries in an excel table. the end result should look like: 
 
 
 
Yet in my case the App only adds the first row to the Table. 
 
and I get the error message: The element has already been created on the server.
 
   
 
Code for the Collection: 
Collect(MaterialSammlung; { Auftrag:SelectedOrder.Aufträge; Material:MaterialEingabe.Text })
 
Code for the Button:
ForAll(
    MaterialSammlung;
    Patch(
        Tabelle2;
        Defaults(Tabelle2);
        {  
            Werk:"Test";
            Lager:"Test";
            Auftrag: SelectedOrder.Aufträge;
            Material: ThisRecord.Material;
            Menge:"Test";
            BMOT:"Test"
        }
    )
)
 
Thank you for the Help!!
 
I have the same question (0)
  • Verified answer
    Michael E. Gernaey Profile Picture
    53,969 Moderator on at
    Hi,
     
    Do this
     
    1. Before the for all add this
    Set(materialCheck, Text(CountRows(MaterialSammlung)));
     
    2. run the app and do it so you think it should loop more than 1 time
     
    3. soon as you trigger this and its complete. Stop playing the app
    go into the Settings, Variables, and see what materialCheck value is 1 or greater

    if greater, then you need to verify that you are in fact passing different values each time so that its not doing an update (regardless of what it shows there) as it sounds like you are doing this (passing duplicates)

     
    WAIT after I typed all of that, i saw that you had other details which sort of talk to my points (sorry its late)
    Collect(MaterialSammlung; { Auftrag:SelectedOrder.Aufträge; Material:MaterialEingabe.Text })
     
    what I do not see is the data from the MaterialSammlung
     
    So run it like i said above. Get the Count as I said, but after looking at the materialCheck value, look at collections, and see what value are exactly in the materialSammlug
     
    I mean you dont even need a collection, since you have a gallery, just iterate though Gallery.Allitems this way you will for sure NOT have duplicate values in the collection.
     
     
     
  • HumuHumu Profile Picture
    4 on at
    Thx for the Answer!! i implemented a Counter to the Collection and it counts the number of Materials I add. The Number of Counter is added to the Order Number: Order-1, Order-2 and so on....

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 556

#2
WarrenBelz Profile Picture

WarrenBelz 412 Most Valuable Professional

#3
Haque Profile Picture

Haque 296

Last 30 days Overall leaderboard