1.Create a csv file as following picture shows. Enter document library title in the csv file.
2.Please run below PowerShell.
$DisplayName = "testtextcolumn"
$InternalName = "testtextcolumn"
$Credential = Get-Credential
Connect-PnPOnline -Url "https://tenant.sharepoint.com/sites/emilytestnew" -Credential $Credential
$filePath = “C:\Users\spadmin\Desktop\dl.csv”
$csv = Import-Csv $filePath
$a = $csv.Title
ForEach($_ in $a) {
Add-PnPField -List $_ -DisplayName $DisplayName -InternalName $InternalName -Type Text -AddToDefaultView
}
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.