Permalink
e178151 Sep 1, 2013
@awieser @geekinthesticks
58 lines (45 sloc) 1.82 KB

## Time-stamp: <2012-03-03 15:50:06 armin> ## This file is best viewed with GNU Emacs Org-mode: http://orgmode.org/

memacs_csv

Data Source

Comma seperated values (CSV) files are quite common method to export various data.

Example Invocation

Because memacs_csv is general for the whole of memacs (not for a specific datasource) there are a lot of parameters.

  • encoding (optional) It is important to know the source’s encoding. (default is utf-8)
    -e <encoding>
        

    or

    --encoding <encoding>
        

    replace <encoding> with the apropriate encoding. See http://docs.python.org/library/codecs.html#standard-encodings for possible encodings.

  • timestamp-index (required)
    -ti <timestamp-index>
        

    or

    --time-stamp-index
        

    the index/column of the containing time-stamp (we start counting with 0)

  • timestamp-format (required)
    -tf <timestamp-format>
        

    or

    --time-stamp-format
        

    the format of the timestamp i.e. “%d.%m.%Y %H:%M:%S:%f” for “14.02.2012 10:22:37:958”

  • output-indices (required)
    -oi <output-indices>
        

    or

    --output-indices <output-indices>
        

    The indices/columns of we want to see in Orgfile. i.e. “1 2 3” for indices/columns 1,2 and 3.

  • delimiter (optional) Default delimiter is “;” specify other delimiters with
    -d <delimiter>
        

    or

    --delimiter <delimiter>
        

Example

example.csv:

23.02.2012;"Amazon";23.02.2012;100,00;EUR;23.02.2012 14:40:59:936;

Invocation:

*/60   *   *   *  *    /home/user/bin/no-power-supply.sh || $MEMACS_DIR/memacs_csv.py -o $ORG_DIR/csv_finance.org_archive --encoding "latin-1" -ti 5 -tf "%d.%m.%Y %H:%M:%S:%f" -oi "4 3 1"

output:

* Memacs for csv files 						 :Memacs:csv:
** <2012-02-23 Thu 14:40:59> EUR 100,00 Amazon
   :PROPERTIES:
   :ID:         da39a3ee5e6b4b0d3255bfef95601890afd80709
   :END: