05 July

Excel VBA Version Control with GIT

Using LibreOffice to simplify MS Excel control with GIT

You might have tried using Microsoft's Excel XML in zip container (.xlsx and .xslm) for version control and found the vba was stored in vbaProject.bin (which is useless for version control).

The solution is simple.

  1. Open the excel file with LibreOffice Calc
  2. In LibreOffice Calc
    1. File
    2. Save as
    3. Save as type: ODF Spreadsheet (.ods)
  3. Close LibreOffice Calc
  4. rename the new file's file extension from .ods to .zip
  5. create a folder for the spreadsheet in a GIT maintained area
  6. extract the zip into it's GIT folder
  7. commit to GIT

When you repeat this with the next version of the spreadsheet you'll have to make sure you make the folder's files exactly match those in the zip container (and don't leave any deleted files behind).

Posted by DaveSaunders at 20:00