20 January 2014

Convert Old Office Files Into New Formats With PowerShell

PowerShell iconIn an earlier blog post I wrote about my assignment where I am moving millions of Office files to SharePoint. In that process I also convert files with the old suffixes into the modern, XML based file formats introduced with Office 2007.

I will describe my work in a series of articles, and now the first one of them has been published. In the Tips section you can find a new article and a demo on conversion of old office files into new formats, what to consider and how it can be done. The same demo is included in this blog post.

Maybe you wonder why you should bother to convert your Office files with the .doc, .xls or .ppt extensions. Can't they stay as they are? As long as new Office versions support these formats the answer is actually yes, but there are several benefits to gain from a conversion to modern file formats like .docx, .xlsx and .pptx:
  • They save space, as they are automatically compressed with a .zip technique.Office 2013 logo
  • They are more secure as files with the x suffix don't allow macros.
  • They separate different data components from each other, so that files can be opened even if a component – for exampel a chart – is damaged.
  • As they all build on Open XML you can unlock information in existing systems and use it in Office programs, and information created in Office can be used by other business applications.
broken linkConversion of old file formats into new ones have one important disadvantage: links will be broken. There is no easy way to keep links to the old files in other documents, on webpages, in e-mails and so on. You should consider this problem before you start converting old files.

PowerShell script
There are several ways to convert the files. Microsoft has given a tool for it, and you can also open each file and save it as a file with the new format. This is very time consuming, but I have created a PowerShell script that basically does exactly that.

The PowerShell script gives more control that the Microsoft tool, and another advantage is that it retains the change date of the files that are converted.
SharePoint Saturday badge
SharePoint Saturday
The information in this tutorial will be included in my speech at the SharePoint Saturday in Stockholm this week. In that speech I will give much more information, and some of that content will become additional Tips.

So, if you have been thinking about moving old Office files to SharePoint you are welcome to take advantage of everything I will share. The script I am showing in the demo can be downloaded from the Tips article about converting old Office files into new formats. I will come back with more tips and scripts later!

By Peter Kalmstrom
CEO and Systems Designer Business Solutions