farling42 / obsidian-import-json

Plug-in for Obsidian.md which will create Notes from JSON files
MIT License
85 stars 5 forks source link

Read CSV Headers in Template #35

Closed herculosh closed 1 year ago

herculosh commented 1 year ago

Hi,

I would like to read all Column-Headers in the CSV and list each column and field as Tag in the Template. How can I read the inside the the Handlebar template?

TIA

farling42 commented 1 year ago

This is just a general Handlebars question, rather than a specific issue to do with this plug-in.

You can use the following to get the list of column names that appear in the CSV file:

{{#each this}} {{{@key}}}: {{{this}}}
{{/each}}

(I used three {{{ around the internal variables in order to ensure that HTML escaping of special characters was NOT performed.