Hi @jennyKim
You can get siteurl from $Row. Please refer to the following script
#Set Parameters
$CSVFilePath = "C:\Users\Downloads\Document.csv"
#Get the data from CSV file
$CSVFile = Import-CSV $CSVFilePath
#Read CSV file and create List
ForEach($Row in $CSVFile)
{
$SiteURL=$Row.SiteURL
#Connect to the site
Connect-PnPOnline -Url $SiteURL -Interactive
Try {
#Create List
Write-host -f Yellow "Creating List:"$Row.ListName
If($Row.OnQuickLaunch -eq "True")
{
New-PnPList -Title $Row.ListName -Template $Row.Template -OnQuickLaunch -ErrorAction Stop | Out-Null
}
else
{
New-PnPList -Title $Row.ListName -Template $Row.Template -ErrorAction Stop | Out-Null
}
Write-host -f Green "`tCreated List '$($Row.ListName)'"
}
Catch {
write-host -f Red "`tError:" $_.Exception.Message
}
}
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.