CSV export / import
willemferguson at zoology.up.ac.za
Sun Dec 21 22:40:35 PST 2014
On 21/12/2014 22:43, Dirk Hohndel wrote:
> So one of the things that I thought we should make easier for new users is
> the ability to add dives that they have in a paper logbook.
> So what I think we SHOULD support is something like this:
> "dive number", "date", "time", "duration", "max depth", "avg depth", "air temp", "water temp", "start pressure", "end pressure", "location", "divemaster", "buddy", "notes", "suit", "rating", "visibility"
a) The proposed headings. It would make things much more user friendly
if the import could only require any or all of the above fields. Define
a full set of headings recognised by Subsurface (like above) and require
that there should be at least date, time, duration, depth. Then the user
can use any subset or the full set of the remaining headings.
Similarly on export, do not use any of the standard set of headings
(above) which do not have valid data.
b) The biggest problem, however, is the data format. For CSV I would
expect a pretty formal comma-delimited format, probably enclosing
strings with quotations, like in the list above. As far as I understand
the current CSV import does not require a string delimiter because a
field delimiter (comma, tab) is sufficient. Because, even with
tab-delimited data, the headings and the rest of the data are unlikely
to align nicely in a text file, a more friendly mechanism is required.
With LibreOffice one has pretty good control over the export with
options for both a text delimiter and a field delimiter. But Windows
does crazy things. By default it has no string delimiter and it uses a
comma as a field delimiter and as far as I can ascertain one cannot set
the field delimiter to anything else than a comma. So TAB is out, as I
discovered after opening the CSV export file using a hex editor. BUT,
one can get a tab-delimited file by exporting it as a .txt file.
So the biggest problem is defining a user friendly interface that allows
rapid entry of the dive data and which allows for an export that
Subsurface can recognise cross-platform (almost surely spreadsheet
software). This is the part that will require the largest amount of
Currently LibreOffice and Excel should produce the same CSV files if a
string delimiter is not used and a comma is used for a field delimiter.
But comma-delimited files are a pain to fine-tune by hand, for instance
if Subsurface finds some formatting problem on line 22 of the import file.
More information about the subsurface