5

I'm looking for a way to perform version control on excel files in git. I understand this question has been asked before, but I couldn't find an option that will work for an excel file with multiple sheets in it. For instance, in the suggestions offered here, one way is to save .xlsx file as a csv file and use git diff. However, this option doesn't work when there are multiple sheets. I'll be able to save only the active sheet as csv file.

The second option that has been suggested on SO is GIT XL. From what I understand from the documentation of GIT XL, the diff option will allow me to view the lines that are altered in the command prompt. For example, if there are 10 columns in an excel sheet and I replace the value in all ten columns how can I view the data that was present previously. To give a better context, the contents of the sheet in excel is overwritten every time I run a script for different values of parameters. In such a case, I don't want to re-run the script each time if I want to view the results of a previous run.

The third answer that I found useful is available here, using xls2text. Again, I would like to know how this will work when there are multiple sheets.

Any suggestions will be of great help!

Natasha
  • 1,111
  • 5
  • 28
  • 66
  • https://www.hertzler.com/manual/9.2.0/4DesignPlan/Templates/2Adv/xls2txt.htm See the 'example' section where you can use the `-s` option. And then you could aggregate all files in one. Write a script to do that if needed. – Philippe May 17 '20 at 15:54
  • `*.xls diff=xls And in the .git/config: [diff "xls"] binary = true textconv = /path/to/xls2txt -s -csv` like this? If this works, multiple files will be created in by github repository? Could you please let me know how this will work ?Every time I commit a change to the .xlsx file the histroy is tracked in these multiple csv files? – Natasha May 17 '20 at 17:33
  • The `-s` option returned multiples files in a folder. For me, you have to wrap the xls2txt command in a script to concatenate the file and return the result in the output. This is that result that will be used to create the diff between 2 commits. – Philippe May 19 '20 at 10:39
  • 1
    This is a great question. But I am just afraid there is currently no solution as xlsx is a coompressed one. I can only have csv or md file version controled in git. xlsx can only be viewed as blob file by git. Leave a commen here to track this thread – Stan Aug 05 '22 at 01:27

0 Answers0