You can find articles on Google, like :
Read the Data inside a single Sheet inside .xlsx file using Power shell
I have an .xlsx which have the following:-
- Stored locally inside C drvie
- contains 5 sheets
- One sheet named as "Info", contain rows and columns without tables. first row represents the headers with filters, and the final row contain totals
- i need to read the data of the excel sheet named "Info" using Power shell
so can anyone advice on this please?
Thanks
4 answers
Sort by: Most helpful
-
-
Rich Matheisen 46,811 Reputation points
2023-01-24T15:43:27.3366667+00:00 Use the ImportExcel module: https://www.powershellgallery.com/packages/ImportExcel/7.8.4
This will import the contents of the Excel files worksheet named "info" and place the date into the array "$f". Each item in $f will be a PSCustomObject.
$f = Import-Excel -Path C:\junk\multisheet.xlsx -WorksheetName Info
-
Limitless Technology 44,401 Reputation points
2023-01-25T09:16:34.9166667+00:00 Hi. Thank you for your question and reaching out. I’d be more than happy to help you with your query.
I have linked an article below that may help solve your issue. Here is what the article has to say:
Use Import-Excel to read data directly from excel files. For instance, try the following to only receive the financial information for December:
path with excel files
(assuming you downloaded the sample data as instructed before)
Set-Location -Path "$env:temp\excelsampledata"
Import-Excel -Path .\financial.xlsx | Where-Object 'Month Number' -eq 12 | Out-GridView
Import-Excel automatically reads data from the first worksheet. Use the parameter -WorksheetName to indicate the name of each worksheet in your file if it has more than one.
REFERENCE: https://powershell.one/tricks/parsing/excel
If the reply was helpful, please don’t forget to upvote or accept as answer, thank you.
-
Limitless Technology 44,401 Reputation points
2023-01-25T09:16:51.9033333+00:00 Double post