41

We're trying to move our project documentation process from Google Documents to a set of self-hosted Git repositories.

Text documents are Git-friendly enough, since we usually do not need any fancy formatting, we'll just convert everything to, say, multimarkdown with an option to embed LaTeX for complex cases.

But spreadsheets are quite different story... Is there a spreadsheed(-like) format that is friendly to version control systems (and, preferably, is as human-readable as Markdown)?

"Friendly format": Git works well with the format (it doesn't with XML) and it generates human-readable diffs (extra configuration involving external tools is OK).

Obviously, Markdown flavors allow one to build static tables, but I'd like to be able to use stuff like SUM() etc... (Note that CSV has the same problem.) No WYSIWYG is OK, but decent editor/tool support would be nice.

Update: Linux-friendly answers only, please. No MS Office stuff.

7
  • 2
    Exactly what do you mean by "git-friendly"? I haven't used git a whole lot, but it handles binary files just fine and they can be versioned and tagged just like any text file. They just can't be diffed, but that may not be necessary.
    – Thomas Owens
    Jan 4, 2013 at 12:38
  • Friendly: I can view diff and easily figure out what was changed. Updated the question to reflect that. BTW, AFAIR, git, when properly configured, can show diffs for some binary formats (with the help of external tools, of course). Jan 4, 2013 at 15:03
  • I can't believe no one has asked you this but why do you need to store spreadsheets in the project repository? what are the spreadsheets for? usually they're complex enough that you need them in a different location and they're usually used by business people...
    – user7433
    Jul 17, 2013 at 18:30
  • 2
    This question appears to be off-topic because it is not related to programming.
    – user53019
    Jul 17, 2013 at 21:17
  • An alternative to trying to find or create a whole new format suitable for regular diffs, is to find or create a tool to diff regular spreadsheets and produce text output. That is what the open source ExcelCompare software does, for Excel, OpenDocument etc. And that way of viewing the question is even suitable for a software development Q&A site :) See version control - How do I diff two spreadsheets? - Stack Overflow and the software itself is at na-ka-na/ExcelCompare
    – nealmcb
    Oct 14, 2014 at 2:16

6 Answers 6

13

You can also use libreOffice/open-office-spreadsheet-non-zip-xml-fileformat "*.fods" which is plain xml. @glenatron s comment applies to this format, too.

The standard open ofice spreadsheet format "*.ods" is zipped xml and not so suitable for git (similar to @Egryan/@emuddudley answer).

7
  • I would like to avoid XML. Updated the question to reflect that. Jan 4, 2013 at 15:10
  • 2
    1. LibreOffice does work on Linux, indeed. 2. No, XML is not MS bullshit. However, XML and Git do not work well together (see @glenatron's comment above). Jan 4, 2013 at 18:27
  • 4
    @LazyBadger: DiffDog: no Linux support, closed-source, 500$/user. Sorry, but I'll pass. Jan 4, 2013 at 19:39
  • 2
    @AlexanderGladysh - Meld, xmldiff or How can I diff two XML files? topic on SU Jan 4, 2013 at 19:49
  • 1
    @LazyBadger: Note that 3-way merge is more important than, diff-ing. (But Google finds several suitable Linux command-line 3-way merge tools for XML.) I'll try these against LibreOffice spreadsheets, thanks. Jan 4, 2013 at 20:30
9

This may not fit your needs, but may fit another's. Org-mode for Emacs includes table.el, which, along with Org-mode's particular enhancements, provides an extremely robust solution for spreadsheets, all in plain text. More information (much more than the scope of this site) is available at Org-mode's website and manual, particularly its spreadsheet tutorial.

enter image description here

4

What about pyspread? It's powerful and comes with a nice GUI.

According to the First Steps page:

The pys file format has changed in version 0.2.0. It now is a bzip2-ed Text file with the following structure:

[Pyspread save file version]

0.1

[shape]

1000 100 3

[grid]

7 22 0 'Testcode1'

8 9 0 'Testcode2'

[attributes]

[] [] [] [] [(0, 0)] 0 'textfont' u'URW Chancery L'

[] [] [] [] [(0, 0)] 0 'pointsize' 20

[row_heights]

0 0 56.0

7 0 25.0

[col_widths]

0 0 80.0

[macros]

Macro text

The fact that it is bzip2-ed does not help but at least you can access a quite readable text.

Licence is GPLv3.

0
4

CSV (Comma Separated Values)

If you're just working with data it's probably the simplest and most commonly supported format.

Should make life easy if you want to diff between versions.

Oh, and Google Docs fully supports CSV import/export.

Update:

Then just write a Google Apps Script to stringify the formulas on export and do the reverse on import. You'll need to use some ingenuity because the format you're looking for doesn't exist.

4
  • 2
    Unfortunately, CSV does not support formula stuff like SUM() etc. Jan 4, 2013 at 17:05
  • I updated the question to say that explicitly. Jan 4, 2013 at 17:20
  • 2
    @AlexanderGladysh, actually I'd say CSV can handle equations just fine if you pick the right format, the issue is that you'd need to configure a reader such that it parses and evaluates those equations.
    – zzzzBov
    Jul 17, 2013 at 21:04
  • Emacs csv-mode might be a nice tool. I also consider Gnumerics for lightweight csv editing. Have yet to try these extensively. Feb 9, 2014 at 23:55
1

I know that Microsoft Office 2007 and higher default to a propitiatory xml format when they save. So that should be friendly for Git. Open office also saves to a xml format if you are wanting to use a more open source solution. Since a XML is a text format git should be able to handle it fairly well

Since you are moving it from Google Documents you can download them has open documents which are xml based.

Edit

Since you are wanting a non Microsoft/XML solution you could always save has a CSV in open office though I am not sure how much functionality you lose by saving to this format.

4
  • 3
    I have seen some problems with Git disagreeing with XML formats or merging them in ways that aren't compliant with the format of the document. I believe this can be worked around by using an XML-specific merge tool, but I haven't seen this in use.
    – glenatron
    Jan 4, 2013 at 13:06
  • 4
    The Excel Workbook (*.xlsx) format is a collection of XML files in a ZIP container. You can choose XML Spreadsheet 2003 (*.xml) to save into a single XML file, but it only supports a subset of Excel's features. Jan 4, 2013 at 14:00
  • 1
    XML wouldn't do, as per @glenatron comment above (I myself had such problems as well). Also: XML diffs are not quite human-readable IMO. Updated the question to reflect that. Jan 4, 2013 at 15:09
  • Well, CSV does not support any formula stuff. I can just use Markdown's tables then. Updated the question to reflect that. Jan 4, 2013 at 17:06
0

This might not be exact what you want I believe that libre office lets you reference outside file. You could have a spreadsheet that you treat like a database and have a static libre file that would be your interface. You would lose easy access summing in your versioned files unless you call them back, but it would work.

Another rather big issue with this would be that it is one directional.

Not the answer you're looking for? Browse other questions tagged or ask your own question.