For the custom column in my library, I'm seeing the following entry in the OPF:
Code:
<meta name="calibre:user_metadata:#fach" content="{"is_category": false, "colnum": 2, "kind": "field", "is_custom": true, "name": "Fachbuch", "#extra#": null, "datatype": "bool", "rec_index": 20, "search_terms": ["#fach"], "#value#": true, "link_column": "value", "label": "fach", "is_editable": true, "column": "value", "is_multiple": null, "category_sort": "value", "table": "custom_column_2", "display": {}}"/>
This is a tristate binary column. From that, I'm guessing that user defined columns are stored in metadata entries of the form
Code:
<meta name="calibre:user_metadata:#name_here" content="settings_here"/>
I'm also seeing that extracting the settings would take quite a bit of matching.