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 / Patch Sharepoint list ...
Power Apps
Answered

Patch Sharepoint list with Lookup Column with data from Collection

(0) ShareShare
ReportReport
Posted on by 181

Hi,

 

I am trying to load an Excel Table into a Sharepoint List with Contacts. The contact records have a Lookup field to link to a Company name from another SP list. In the Excel table there is a column with company name, and now I am trying to load contacts from Excel and link all contacts to their respective companies. The company names already exists in the Company SP list. (I have preloaded them).

 

I am importing the data from Excel to a Collection and then I am trying to use Patch to load the data. But I can't figure out how to store the company name into the lookup field.

 

I am using the following code:

 

ClearCollect(colContacts; 
 Filter(
 Filter(
 FirstN(PAImport; 5);
 IsMatch(Organisationsnummer;"\d{6}-\d{4}";MatchOptions.Complete ) ||
 IsMatch(Organisationsnummer;"\d{6}-XXXX";MatchOptions.Complete)
 );
 
 !StartsWith(Organisationsnummer;"2")
 )
 );;


/* Save to Sharepoint */
ForAll(colContacts; 
 Patch(Kontakter; Defaults(Kontakter); 
 { 
 'Namn (field_Column2)': Kontaktperson ; 
 Epost:Mailadress; 
 Organisation: 
 Table( 
 { 
 '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference";
 Id:1;
 Value:'Bolag/Aktör'
 }
 )
 }
 )
)

 

 Any help would be appreciated! 🙂

Categories:
I have the same question (0)
  • Verified answer
    LennartWalldén Profile Picture
    181 on at

    Found the problem:

    I needed to LookUp the ID of the Company in the Company database.

    { 
     '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference";
     Id: LookUp(Verksamheter; Verksamhetsnamn = 'Bolag/Aktör').ID;
     Value:LookUp(Verksamheter; Verksamhetsnamn = 'Bolag/Aktör').Verksamhetsnamn
     }

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 541

#2
WarrenBelz Profile Picture

WarrenBelz 434 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 289

Last 30 days Overall leaderboard