This cheatsheet concerns org mode tables and fantastic things they can be used for.

Tables as data

Header for table : #+NAME: table-as-data

typebruttovat_in_bruttonettovat_percentage
type_ool4900916398422.991968
type_abs141101317.6335878

Elisp code using table as data

;; #+BEGIN_SRC elisp :var table=table-as-data :exports both
(cl-loop for row in table
    collect (cons (format "MATCH (p:publication) WHERE p.label_prop_all = %d return p limit 50" (nth 1 row)) nil))

Result:

MATCH (p:publication) WHERE p.label_prop_all = 4900 return p limit 50
MATCH (p:publication) WHERE p.label_prop_all = 141 return p limit 50

We can even use org-mode table in python!

# #+BEGIN_SRC python :var table=table-as-data
return table[0][0] +" and " +  table[1][0]
: type_ool and type_abs

Spreadsheet functionality

  • $2= Column formula, valid for the entire column
  • @3= Row formula, applies to all fields in the specified row. @>= means the last row. We can denote horizontal separator lines as @I - first line, @II - seconds line. Then we can sum columns from first separator until next via @>=vsum(@I..@II). We can also count from end - @-I is also valid.
  • @1$2..@4$3= Range formula, applies to all fields in the given rectangular

range. This can also be used to assign a formula to some but not all fields in a row.

More: on referencing fields, field and range formulas.

| Count | Weight | TotalKg |
|-------+--------+---------|
|     1 |      2 |       2 |
|     3 |     10 |      30 |
|     4 |     30 |     120 |
|-------+--------+---------|
|     8 |      9 |      72 |
|       |        |       0 |
|-------+--------+---------|
|     8 |     42 |     152 |
#+TBLFM: $3=$2*$1::@>=vsum(@I..@II)

When creating formulas we can use excel-like syntax too - typing :=vsum(B2..B3) in a field adds a working formula.

Elisp in formulas: We can also use elisp in formulas e.g. first formula part in #+TBLFM above could be replaced with:

#+TBLFM: $3='(* $1 $2);N::@>=vsum(@I..@II)

Where ;N tells us to treat numerical values as numbers not strings.