cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Sidhant_02
Post Prodigy
Post Prodigy

Import Data using Excel/PDF in Power Apps

Hi everyone,
Currently to take in user inputs for registration purpose I am using a simple form structure where in user can enter the details as required. 
For example: Qualification

Sidhant_02_0-1699363532460.pngSidhant_02_1-1699363571883.png

There is a gallery wherein I am showing all the data that the user has entered:

Sidhant_02_2-1699363632690.png

Now to make this more simpler what I want to do is add a button named Import from File, where in there will be the qualifications details for the user and using the file that is uploaded it should save all the details similar how we did using the form (which should be associated only for the current user not others: for which in case of forms I have used the MS365.Id and the Employee Id field).

Filter(SkillMatrix_Certifications,EmployeeId= Office365Users.MyProfile().Id)


My form has multiple sections like certification details, project details, skills, qualifications. So currently I am trying to import one section from the file, but later on if we have to import all the data in their respective field like qualifications should populate in its field not others, how to do that (is it part of AI builder) - {this can be done later}
For now I am focusing one part (qualifications}, in this case if anyone has any idea on how to solve this please do reply it will be helpful.

Regards,
Sidhant.

39 REPLIES 39

Hi @Pstork1 ,
Thanks for the response, I have done the following
1. On the gallery to display records for the current user I have added the following expression

 

Filter(Details,'Created By'.Email = User().Email)

 

(Here Details is the name of the SharePoint list, where all the records are uploaded)

2. To avoid duplicate uploads by any user ( one user should upload a file once not more than that), for that I created a local variable that checks in the SharePoint list if there any more records modified by a user or not based on that perform Patch

Sidhant_02_0-1701240200320.png

 

(Is this correct, and how to manage the delegation issue), if not could you please give an example (by referring the information provided on how to check for duplication upload by a user)

3. To download the template file, as you mentioned I uploaded the template file with the headers (in the Sharepoint document library) 

Sidhant_02_1-1701242403427.png

 

And added a button using launch (mentioned the file URL), from where user can save a copy of the file in their system. I did find a work around wherein we can download the file directly on-click of the button from Power Apps (the file won't be opening in a new tab) for that the Syntax was:
Launch("https://Site_Url/Document_Library_Name/FileName.xlsx")
But this was not working, it displayed file not found

And the other thing you mentioned to check if the file is in the same template format to add a condition before or after List rows (split) could you give an example on how to do the check, it will help.


Regards,
Sidhant.

Pstork1
Most Valuable Professional
Most Valuable Professional

1) Yes, that's exactly what I suggested

2) Instead of using a CountIf() just do a Lookup(). If the result is null then no record exists.   Also, instead of using User().email in the function save that as a variable first to avoid delegation.

3) Make sure you replace all the spaces in the URL with %20. See my example below.

Launch("https://acmee3.sharepoint.com/sites/FlowDemos/Shared%20Documents/Filename.xlsx")

 



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Hi @Pstork1 ,
Thanks for confirming. Regarding replacing the whitespaces as my SharePoint library does not have any spaces in between (previously it was named: Iz Doc to avoid spacing issue I renamed it to IzDoc) so should I still add the 'Iz%20Doc'.

Made the change: 

 

 

Launch("https://iz.sharepoint.com/sites/IntelizignPune/Iz%20Doc/excelImportTemplate.xlsx")

 

 


Now on click initially it shows the page 'Did not find the page, check spelling for 2 seconds' and then starts the download but get this screen:


Sidhant_02_0-1701323085534.png

So I uploaded the file in Documents (Shared Documents - system default name} and used the following:

Launch("https://iz.sharepoint.com/sites/IntelizignPune/Shared%20Documents/excelImportTemplate.xlsx")

This works fine

- For your second point about the condition for duplication check is this correct:

 

//Storing the user.email in a variable:
UpdateContext({lclUserMail: User().Email});

//Duplication Check
UpdateContext({lclRecordCheck: LookUp(Details, 'Modified By'.Email <> lclUserMail, true)});

If(lclRecordCheck,

ForAll(Details,
    Patch(Employee_Projects,
    Defaults(Employee_Projects),
    {
        Title:ThisRecord.Project1,
        Description:ThisRecord.Description1,
        EmployeeId:Office365Users.MyProfile().Id
    }
    )
),
Notify("Duplicate Record, one user can only upload one file",NotificationType.Information)
)

 


- And the other thing that I had doubt using 'Modified By ' how can we determine that a particular user is  not imported data from excel more than once (as modified by generally tracks changes made to a record)

- Also for the template check you had mentioned to have a check in the flow could you explain in the context of my example.

Regards,
Sidhant.

Hi @Pstork1 ,
Earlier to patch the records associate with a user I was using:

Sidhant_02_1-1701327354485.png

For which you suggested to make use of email instead of Id, but later on when there will be more than one record or row in the SP list like:

Sidhant_02_2-1701327442867.png

So in that case the Patch statement that I have used will it work & how will it differentiate which is record is for which user and according patch, I was thinking of the : 'Office365Users.MyProfile().Id' but how this can be used while mapping the data in the Patch statement is where I am confused
(This is the current Patch statement: wherein as discussed we are checking for duplicate entries by a user)

//For Duplicates:
UpdateContext({lclRecordCheck: LookUp(Details, 'Modified By'.Email <> lclUserMail, true)});

UpdateContext({lclRecordsCount: CountIf(Details,'Modified By'.Email = User().Email)});




If(lclRecordCheck,

ForAll(Details,
    Patch(Employee_Projects,
    Defaults(Employee_Projects),
    {
        Title:ThisRecord.Project1,
        Description:ThisRecord.Description1,
        EmployeeId:Office365Users.MyProfile().Id
    }
    )
),
Notify("Duplicate Record, one user can only upload one file",NotificationType.Information)
)


So now if had to also map record details of different users how to do that.

Regards,
Sidhant.

Pstork1
Most Valuable Professional
Most Valuable Professional

You can change the display name, but that doesn't change the actual url. It will still have spaces, so yes you need to replace those.

 

Not sure why the login prompt is coming up, but you do have to be logged in to download the file.

 

For the second part I was suggesting this

UpdateContext({lclUserMail: User().Email});
If(
    IsBlankOrError(
        LookUp(
            Details, 
            'Modified By'.Email = lclUserMail,
            Title
        )
    ),
    UpdateContext({lclRecordCheck: 0}),
    UpdateContext({lclRecordCheck: 1})
)

if lclRecordCheck is zero there is no duplicate. If its 1 there is.

Using Modified by means that the user uploading a second file will be the same as uploading the same file twice. You said that a user should only have one entry.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Pstork1
Most Valuable Professional
Most Valuable Professional

Different users will generate different Created By and Modified By entries in SharePoint. You can use that and the user().Email to track which user uploaded information for which record.  Weve already discussed that several times. Its the same as using the ID, but you don't need to use Office365Users to get the ID because the email is already available.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Hi @Pstork1 ,
I know you have mentioned this in your replies previously, but it will be helpful if you can provide an expression for the same (like how you shared for the duplicate one as per my data-source)

And on using the user.mail() when we have more than 1 record in the SharePoint list (which stores the data extracted from the excel uploaded), do we need to make changes to the Patch statement because I am thinking ThisRecord will point to the very first row and if data like this (or is it something else):

Sidhant_02_0-1701422905747.png

 

(Just as reference assuming there are more than 1 row, so in that case how should we tell ThisRecord to refer to particular row, which you suggested)
If possible could you give an example w.r.t my context (from the information I have shared earlier)

I tried this, but I guess this is not right:

Sidhant_02_1-1701424800210.png

 



Regards,
Sidhant.

Pstork1
Most Valuable Professional
Most Valuable Professional

ThisRecord doesn't really mean anything outside of a ForAll() function. In the ForAll function it refers to the current record that the formula is being applied to. I don't see any ForAll in your code and I think that is why its throwing an error.  But the main point is What are you trying to patch? ForAll only works if you are updating a set of records with a formula.  I've also already explained that if you use the user's email, which is already there, then you don't need the Account ID. But that appears to be the only thing this formula is updating. So why do you even need it?



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Hi @Pstork1 ,
I guess the ForAll was not visible due to the error message, the expression was as follows:

If(
    IsBlankOrError(
        LookUp(
            Details, 
            'Modified By'.Email = lclUserMail,
            Title
        )
    ),
    UpdateContext({lclRecordCheck: 0}),
    UpdateContext({lclRecordCheck: 1})
);




If(lclRecordCheck  = 0,

ForAll(Details,
    
    Patch(Employee_Projects,
    Defaults(Employee_Projects),
    {
        Title:ThisRecord.Project1,
        Description:ThisRecord.Description1,
        EmployeeId:Office365Users.MyProfile().Mail
    }
    )
    
),
Notify("Duplicate Record, one user can only upload one file",NotificationType.Information)
)

So now before patching the Projects data we need to perform a check that only save the data that is created by the current user (and not others data), so the check condition where should that be placed and I have removed the MyProfile.Id() as you said and instead of that I am making use of the mail field so is that what you were asking for.

Also in one of your replies you had mentioned for the template check that has the user used the same template that we have provided has entered the data in it, if they have used the same template as provided then proceed with the normal flow or else if the user has used some other file then stop the process and notify the user 'Please use the Template format' so for that how the check will be added in the flow can you give an example.

Sidhant_02_0-1701840503073.png

 




Regards,
Sidhant.

Pstork1
Most Valuable Professional
Most Valuable Professional

1) As I mentioned in my last reply you don't need the patch at all if the only unique value you are patching is the account ID. The user's created by email is there automatically and fulfills the same purpose.

2) If a user can have multiple records then tracking things by the email alone, or the account ID, isn't enough. You need to have a way to access each individual record uniquely.

3) If the user uses a table that doesn't match your schema then it will throw errors when you try to read it or certain columns won't be there.  So add a parallel branch to the flow after the list rows action and set it to run if the list rows action throws an error.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!   This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions in the Forums to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersNumber of SolutionsSuper UsersNumber of Solutions @anandm08  23 @WarrenBelz  31 @DBO_DV  10 @Amik  19 AmínAA 6 @mmbr1606  12 @rzuber  4 @happyume  7 @Giraldoj  3@ANB 6 (tie)   @SpongYe  6 (tie)     Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersSolutionsSuper UsersSolutions @anandm08  10@WarrenBelz 25 @DBO_DV  6@mmbr1606 14 @AmínAA 4 @Amik  12 @royg  3 @ANB  10 @AllanDeCastro  2 @SunilPashikanti  5 @Michaelfp  2 @FLMike  5 @eduardo_izzo  2   Meekou 2   @rzuber  2   @Velegandla  2     @PowerPlatform-P  2   @Micaiah  2     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Week 3:Community MembersSolutionsSuper UsersSolutionsPower Apps anandm0861WarrenBelz86DBO_DV25Amik66Michaelfp13mmbr160647Giraldoj13FLMike31AmínAA13SpongYe27     Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Week 4:Community MembersSolutionsSuper UsersSolutionsPower Apps DBO-DV21WarranBelz26Giraldoj7mmbr160618Muzammmil_0695067Amik14samfawzi_acml6FLMike12tzuber6ANB8   SunilPashikanti8

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages