Hello,
You can use the following code:
#Config Parameter
$SiteURL = "https://domain.sharepoint.com/sites/sitename"
$ListName = "listname"
#InternalName of the selected fields
$SelectedFields = @("ID","Title","Choice1","Person1","Date1")
$CSVPath = "C:\Temp\ListData.csv"
$ListDataCollection= @()
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)
$Counter = 0
#PageSize:The number of items to retrieve per page request
$ListItems = Get-PnPListItem -List $ListName -Fields $SelectedFields -PageSize 2000
#Get all items from list
$ListItems | ForEach-Object {
$ListItem = Get-PnPProperty -ClientObject $_ -Property FieldValuesAsText
$ListRow = New-Object PSObject
$Counter++
ForEach($Field in $SelectedFields)
{
$ListRow | Add-Member -MemberType NoteProperty $Field $ListItem[$Field]
}
Write-Progress -PercentComplete ($Counter / $($ListItems.Count) * 100) -Activity "Exporting List Items..." -Status "Exporting Item $Counter of $($ListItems.Count)"
$ListDataCollection += $ListRow
}
#Export the result Array to CSV file
$ListDataCollection | Export-CSV $CSVPath -NoTypeInformation
Cited from https://learn.microsoft.com/en-us/answers/questions/796617/powershell-retrieve-sharepoint-list-data
If this is helpful please accept answer.