Skip to content

Latest commit

 

History

History
65 lines (50 loc) · 2.49 KB

memacs_csv.org

File metadata and controls

65 lines (50 loc) · 2.49 KB

## 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.

Options

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

  • -f, --file input csv file (required)
  • -d, --delimiter defaults to semicolon
  • -e, --encoding see encodings, defaults to utf-8
  • -n, --fieldnames header fieldnames of the columns (add a comma at the end, if data rows end with delimiter)
  • -p, --properties fields to use for properties (optional)
  • --timestamp-field field name of the timestamp (required)
  • --timestamp-format format of the timestamp, see strftime for possible formats, defaults to unix timestamp
  • --output-format format string for the output, see format and use the fieldnames as named placeholders (required)
  • --skip-header skip first line, only necessary if you want to overwrite existing header fieldnames (optional)

Example

To get familiar with the anticipated formatting of files to process, the clone of the project from GitHub includes test data in path Memacs/memacs/tests/data/ like example1.csv and example2.csv showcased below.

memacs_csv.py -f memacs/tests/data/example1.csv \
              --fieldnames "date,text,value,currency," \
              --timestamp-field "date" --timestamp-format "%d.%m.%Y" \
              --output-format "{text}" --properties "currency,value"
* Memacs for csv files          :Memacs:csv:
** <2012-02-23 Thu> Amazon
   :PROPERTIES:
   :CURRENCY:   EUR
   :VALUE:      100,00
   :ID:         3f4898135bc340ede51aff4519ebd54db92fe23c
   :END:

* successfully parsed 1 entries by bin/memacs_csv.py at [2017-02-24 Fri 00:52] in ~0.014384s .

memacs_csv.py -f memacs/tests/data/example2.csv \
              --delimiter "|" --timestamp-field "date" \
              --output-format "{text}"
* Memacs for csv files          :Memacs:csv:
** <2012-02-23 Thu 14:40> Alibaba
   :PROPERTIES:
   :ID:         08cfc2bf06e9f2a235641912ea7c7d7c87072ad3
   :END:

* successfully parsed 1 entries by bin/memacs_csv.py at [2017-02-24 Fri 00:59] in ~0.007200s .