cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Tbruns
Post Patron
Post Patron

Paste Multiple Entries into a Power App?

So I have a PowerApp on Sharepoint that works great but I am wondering if I can get it to work even better!

 

Right now, we are manually entering each individuals First Name, Last Name, Phone, Security ID. We receive this information via email on a Excel Spreasheet. Sometimes there can be as many as several hundred individuals we have to manually enter, which is time consuming.

 

I am wondering if there is a way for Power Apps to allow me to copy multiple individuals from the excel spreadsheet and paste into the Power App? Or could Flow help with this?

 

I would appreciate any ideas and or help on this.

 

Tbruns_0-1607616238595.png

 

29 REPLIES 29

@RandyHayes  does the above screen shot help?

 

RandyHayes
Super User
Super User

@Tbruns 

I'm not entirely sure what that image shows.  That appears to be one of the screens in the app.  What I am looking for is what is the formula that you use to collect items into Collection 2?

Does it have initial data when displayed to the user, or is it empty and the goal is to fill it?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Tbruns
Post Patron
Post Patron

@RandyHayes 

It is empty and the user will fill it in.

RandyHayes
Super User
Super User

@Tbruns 

Very good!

Okay, so I would keep the process of copy and paste separate from adding, removing or altering.  In that scenario, there is no particular need for a Collection.  Your Gallery will already be your collection.

 

Now, for your solution.

Add a Textinput Control to your app and make it multiline.  Let's call it txtPastedText

Place a Gallery in your app and add 4 TextInputControls to the Gallery Template - let's call them txtFirst, txtLast, txtPhone, txtSecurity

Add a Toggle control to your Gallery template - let's call it tglRehire

Now, set the Items property of your Gallery to the following formula:

ForAll(
    Filter(Split(txtPastedText.Text, Char(10)), !IsBlank(Result)),
    With({pasteData:Filter(Split(Result, Char(9)) As line, !IsBlank(Trim(line.Result)))},
        {firstName: If(CountRows(pasteData)>=1, Last(FirstN(pasteData, 1)).Result, ""),
         lastName: If(CountRows(pasteData)>=2, Last(FirstN(pasteData, 2)).Result, ""),
         phone: If(CountRows(pasteData)>=3, Last(FirstN(pasteData, 3)).Result, ""),
         securityID: If(CountRows(pasteData)>=4, Last(FirstN(pasteData, 4)).Result, ""),
         rehire: If(CountRows(pasteData)>=5, Last(FirstN(pasteData, 5)).Result, "New")
        }
    )
)

 

Now, set the Default properties of the above gallery controls to the following:

txtFirst -  ThisItem.firstName

txtLast - ThisItem.lastName

txtPhone - ThisItem.phone

txtSecurity - ThisItem.securityID

tglRehire - ThisItem.rehire = "Rehire"

 

Run your app and paste data into the textinput control.  Your Gallery will then have the information broken out.

Note: in the shots below, I used this for data:

 

Screenshot 2020-12-16 161439.png

 

Here it is in action:

tBurns.gif

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes 

This is exactly what I needed! You are amazing and I appreciate you! One question...I cannot get the toggle to work. I titled it tglRehire, I changed Default to ThisItem.rehire= "Rehire" but it doesn't like that. What am I doing wrong?

Tbruns_0-1608652574164.png

 

RandyHayes
Super User
Super User

@Tbruns 
Is that toggle in your Gallery?  Tell me more...is the rehire still in the formula I provided or have you modified any?

If you put a Label in the Gallery and set the text to ThisItem.rehire, what do you see?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Tbruns
Post Patron
Post Patron

@RandyHayes 

I got it to work! Thank you so much! You are a time saver!!!!

Tbruns
Post Patron
Post Patron

@RandyHayes  One more question...How do I get the information in my Gallery into my Sharepoint list? Before (when I was using Collections) I used a "Submit" button.

RandyHayes
Super User
Super User

@Tbruns 

I'm not entirely sure how you used the submit button before. But, in general, you would just ForAll the Gallery.

Ex.

ForAll(yourGallery.AllItems, Patch(yourList, Defaults(yourList), {column: control.Text, etc.})

 

That's a very general formula, so if you need more specifics, let me know more about what you had before and I can help build that up.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Tbruns
Post Patron
Post Patron

@RandyHayes 

This is what I had before when I was using Collections.

ForAll(
Collection,
Patch(
'Sharepoint List Name',
Defaults('Sharepoint List Name'),
{
'First Name': Collection2[@FirstName],
'Last Name': Collection2[@LastName],
'Security ID': Collection2[@SecurityID],
}
)
);
Navigate(Screen4)

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (1,557)