Operations on excel file

Welcome Forums General PowerShell Q&A Operations on excel file

This topic contains 1 reply, has 2 voices, and was last updated by

2 years, 7 months ago.

  • Author
  • #53582

    Points: 0
    Rank: Member


    I have an excel file on which i need to do 2 operations:
    1. Check if the file is empty or not. I checked with this code

    if((Get-content "file.txt") -eq $null){"File empty"}else{"File not empty"}

    and replaced an excel instead of .txt, thought the code worked for text files it dint work for excel.
    2. The data received in the excel file is sometimes old, therefore im trying to find out whether the data is correct or old by comparing it with previous sheet(the data is appended to a new sheet of the same excel file everytime). One field has the value "date" which im using to compare.

    Im new to powershell please help me understand the logic.


  • #53593

    Points: 0
    Rank: Member

    PowerShell can access and deal with Excel files in two ways. One is using the Excel application as a COM object. Francois-Xavier Cat has a great blog post on this:


    The other way is if the document is a xlsx file. This is a standardize structured data which PowerShell is great at working with. Warren Frame wrote a handy PowerShell module around it:


    There is Doug Finke's xlsx module as well:


The topic ‘Operations on excel file’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort