Read the Data inside a single Sheet inside .xlsx file using Power shell

john john 1,021 Reputation points
2023-01-23T22:59:35.3733333+00:00

I have an .xlsx which have the following:-

  1. Stored locally inside C drvie
  2. contains 5 sheets
  3. One sheet named as "Info", contain rows and columns without tables. first row represents the headers with filters, and the final row contain totals
  4. i need to read the data of the excel sheet named "Info" using Power shell

so can anyone advice on this please?

Thanks

Windows for business | Windows Server | User experience | PowerShell
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Castorix31 90,686 Reputation points
    2023-01-24T09:04:06.0866667+00:00

    You can find articles on Google, like :

    Read and Write Data to Excel File with PowerShell

    0 comments No comments

  2. Rich Matheisen 47,901 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
    
    0 comments No comments

  3. Limitless Technology 44,766 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.

    0 comments No comments

  4. Limitless Technology 44,766 Reputation points
    2023-01-25T09:16:51.9033333+00:00

    Double post

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.