I recently had a requirement to download excel files from SharePoint and extract the data from the spreadsheet programmatically. This is the script that helped me get the job done.
You have to log onto the SharePoint server.
Open the PowerShell ISE or you can use VScode with the PowerShell extentions.
Import the SharePoint module.
To extract the data I used the module Import-Excel, but that is for another post.