My script so far can read from the first sheet of the excel document, but i need it to read from the second sheet. Any suggestions?
#Read the Excel Data and change path accordingly
$data = Import-Excel -Path "C:TestExcelDoc.xlsm"
#Declare Site URL and List names
$SiteUrl = "https://Consato.sharepoint.com/sites/Stage"
# Update with the internal name of the SharePoint list.
$ListName = "DataList"
#Initiate a connection to SharePoint site
Connect-PnPOnline -Url $SiteUrl -Interactive
try {
ForEach($record in $data) {
Write -Host "Adding record $($record.'Record Series')"
#Add List Items - Map with Internal Names of the Fields!.Below you define a custom object @ {}for each record and update the SharePoint list.
Add-PnPListItem -List $ListName -Values @{
"Title" = $($record.'VALUE');
};
}
} catch {
Write-Host "Error: $($_.Exception.Message)" -ForegroundColor Red
}