Friday, August 15, 2014

Free Convert for Excel files (.xls to .xlsx)

I was pleasantly surprised that Excel 2010 has a command line tool that will convert .xls to .xlsx files. Here is how you use it.

In this example we are converting a file called MyFile.xls in the temp directory to MyFle.xlsx in the same temp directory. I didn't have any luck getting this to work without using absolute path.

  1. Open a command prompt 
  2. Execute the following (after adjusting it to meet your specific environment:
    "C:\Program Files\Microsoft Office\Office14\excelcnv.exe" -oice "C:\temp\MyFile.xls" "C:\temp\MyFile.xlsx"


Since this is command line driven you can script many files easily.


@ECHO OFF
FOR %%X in (".\*.xls") DO IF NOT %%~xX == .xlsx echo Converting "%%~dpnxX"  & "C:\Program Files\Microsoft Office\Office14\excelcnv.exe"  -nme -oice "%%~dpnxX" "%%~dpnX.xlsx" 


WARNING: For some reason Excel may tell you that it didn't launch correctly and ask you if you want to run it in safemode. I have no clue as to why this is, but clicking No each time seems to work fine. It will do this for each file.

9 comments:

Elliot Tabush said...

Brent,
Did you ever find a solution to Safe Mode popup message?

Anonymous said...

Hi - did you ever found a solution for safe mode popup? I am automating the conversion and dont know how I can suppress the popup or choose a default. Any inputs?

SAURONoff said...

Hi! Thank you for this instruction, it was very helpful.
And i have found a way to remove safe mode error!
After every use of excelcnv you need to remove registry key by using "reg delete HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Excel\Resiliency\StartupItems /f"
(change version in "\15.0\" to your version)

Anonymous said...

Excellent, thanks for the registry key fix makes converting large numbers of files a breeze now.

Anonymous said...

Thanks !! This helped me a lot!!

Anonymous said...

Can the excelcnv.exe file be copied from a PC that has it to another PC (Has Excel 2007 on it) and used as described?

Thanks,

Luiz Fernando said...

Thanks! This really helped me :)

Lisa LePome said...

What does the -oice do? I've also seen -nme also without explanation.

Anonymous said...

Here is what you could use as well https://freetools.site/document-converters/xls-to-xlsx