PowerShell function to convert XLS files to XLSX

Migrations… always fun to do when you can automate them.
Let’s say that you migrate from Office 2003 to Office 2010. You may want to convert your ‘old’ XLS files to the new XLSX format.
But you would you do that? I believe there is a tool for that, but my customer asked me to script everything.

So, here’s a script that covers two migration scenario’s:

1) Create the new XLSX files next to the XLS files.
2) Create the new XLSX files in a path that is defined when calling the function.

I also found that hiding the Excel GUI will still convert some files with curruptions in them, when the GUI would provide an error… so I added the -Visible parameter 🙂

Have fun migrating!


  1. user114 says:

    Your script is not working for me?!
    what ive done:
    saved it as .ps1 file.
    Executed it with admin privs – powershell opens and closed again.
    What im doing wrong?
    Powershell Permissions are set to “unrestricted”.
    Please provide me with some more details to get it fixed 🙂
    Thanks in Advance!

  2. Jeff Wouters says:

    Try executing the script from a command prompt like so: .\Script.ps1
    Add the appropriate parameters.
    If there’s still an error, please post it.

Leave a Reply

Your email address will not be published. Required fields are marked *