[email protected] writes:

> Org babel interprets the org table correctly as a variable in the first three
> cases, but if there is a middle rule and no top rule, the first row is 
> ignored.
> An example is shown below and in the attached bugs.org file.

It's not actually ignored.  In fact it is the only case of the 4 that
org correctly parses that the first line in the column names.  In your
first 3 examples org thinks that the column names are part of the data.

#+NAME: spending-3
|------------------+-------+----------+------+-------|
| Date             | Co-op | Starling | Cash | Notes |
|------------------+-------+----------+------+-------|
| <2025-09-23 Tue> |   169 |   105.10 |   75 |       |

#+NAME: spending-4
| Date             | Co-op | Starling | Cash | Notes |
|------------------+-------+----------+------+-------|
| <2025-09-23 Tue> |   169 |   105.10 |   75 |       |


Notice how ":colname-names" is set for spending-4 but not spending-3.

#+begin_src elisp :results pp
(org-babel-process-params (list (cons :var "spending3=spending-3")))
#+end_src

#+RESULTS:
: ((:var spending3 hline ("Date" "Co-op" "Starling" "Cash" "Notes") hline
:        ("<2025-09-23 Tue>" 169 105.1 75 ""))
:  (:colname-names) (:rowname-names) (:result-params) (:result-type . value))

#+begin_src elisp :results pp
(org-babel-process-params (list (cons :var "spending4=spending-4")))
#+end_src

#+RESULTS:
: ((:var spending4 ("<2025-09-23 Tue>" 169 105.1 75 ""))
:  (:colname-names (spending4 "Date" "Co-op" "Starling" "Cash" "Notes"))
:  (:rowname-names) (:result-params) (:result-type . value))


Behavior can be controlled by setting ":colnames"


#+begin_src elisp :var spending4=spending-4
spending4
#+end_src

#+RESULTS:
| <2025-09-23 Tue> | 169 | 105.1 | 75 |   |

#+begin_src elisp :var spending4=spending-4 :colnames yes
spending4
#+end_src

#+RESULTS:
| Date             | Co-op | Starling | Cash | Notes |
|------------------+-------+----------+------+-------|
| <2025-09-23 Tue> |   169 |    105.1 |   75 |       |

#+begin_src elisp :var spending4=spending-4 :colnames no
spending4
#+end_src

#+RESULTS:
| Date             | Co-op | Starling | Cash | Notes |
| <2025-09-23 Tue> |   169 |    105.1 |   75 |       |


You can check the manual for more information that even includes a
python example! [[info:org#Environment of a Code Block]]

I hope this helps!

Morgan

Reply via email to