Hi @Dhamley ,
According to my research and testing, here is an example of using PowerShell to read data from excel, and an example of getting the site owner.
You can refer to it , hope it can help you:
$filePath ="C:\test.xlsx"
# Create an Object Excel. Application using Com interface
$excelObj = New-Object -ComObject Excel.Application
# Disable the 'visible' property so the document won't open in excel
$excelObj.Visible = $false
#open WorkBook
$workBook = $excelObj.Workbooks.Open($filePath)
#Select worksheet using Index
$workSheet = $workBook.sheets.Item(1)
#Select the range of rows should read
$range= 3
for($i=1;$i-le $range;$i++){
$workSheet.Columns.Item(1).Rows.Item($i).Text
}
$AdminCenterURL = "https://xxxxxx-admin.sharepoint.com/"
$SiteURL = "https://xxxxxx.sharepoint.com/sites"
#Connect to SharePoint Online
Connect-SPOService -url $AdminCenterURL -Credential (Get-Credential)
#Get Site owners of all site collections
Get-SPOSite $SiteURL | Select URL, Owner |Export-CSV -Path
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.