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 173

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
    173 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!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 76 Most Valuable Professional

#2
Haque Profile Picture

Haque 69

#3
Kalathiya Profile Picture

Kalathiya 38 Super User 2026 Season 1

Last 30 days Overall leaderboard