Skip to main content

Posts

Showing posts from February, 2025

Import Sharepoint List data with PnP Powershell from excel

  $siteUrl = "[SiteURL]" $listName = "[List NAME]" $excelFilePath = "C:\Users\user254\Downloads\ObservationsImport1.xlsx"  $lookupColumns = @{     "Location_ID" = "WS_Locations"     "Line_ID" = "WS_Line"     "Area_ID" = "WS_Area"     "Sub_Area_ID" = "WS_Sub_Area"     "Category_ID" = "WS_Category"     "Sub_Category_ID" = "WS_Sub_Category" } $nonLookupColumns = @("OBSERVATION_DATE", "SHIFT", "TYPE", "BEHAVIOR", "AT_RISK_BY_UNSAFE_COND", "COMMENTS", "TIME_ZONE", "ROLE") Connect-PnPOnline -Url $siteUrl -UseWebLogin $excelData = Import-Excel -Path $excelFilePath $excelData.Count $lookupDataCache = @{} function Get-LookupId {     param (         [string]$lookupColumn,         [string]$lookupValue     )     $itemId=0                    $lookupListName = $lookupColumn...