The best recommended approach is use the PnP Provisioning template.
Download the PnP Provisioning template using PnP
Filter the downloaded template (xml) because there is no way to generate only the specific list template, by default it will download all lists/libraries from the specific site.
Then create a new list using the filtered PnP template.
Sample code to get specif list from SharePoint Online for PnP Provisioning template:
$listName = "List Title for which want to generate template";
$outputTemplateFileName = "C:\Temp\PnP\SPListPnPProvisioning\ListTemplateDownloaded.xml";
$templates = Get-PnPProvisioningTemplate -OutputInstance -Handlers Lists
$singleListTemplate = $templates.Lists | Where-Object { $_.Title -eq $listName }
$templates.Lists.Clear()
$templates.Lists.Add($singleListTemplate)
Save-PnPProvisioningTemplate -InputInstance $templates -Out $outputTemplateFileName;
Write-host "Successfully PnP list template has been customized for a single list."
How to create a new list in the target site using the downloaded PnP template:
CLS
$userName = "[email protected]"
$passWord = "YourSPOPassword"
$encPassWord = convertto-securestring -String $passWord -AsPlainText -Force
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $userName, $encPassWord
Connect-PnPOnline -Url "https://globalsharepoint2019.sharepoint.com/sites/SharePointRNDClassic" -Credentials $cred
Apply-PnPProvisioningTemplate -Path "C:\Temp\PnP\SPListPnPProvisioning\ListTemplate.xml"
Write-host "Successfully a list has been created in SharePoint online."
Demo Example:
Please read the below article where step by step it is explained how to do with the video demo:
Create SharePoint online list using PnP provisioning template