JSON-CSV Importer

by farling42
5
4
3
2
1
Score: 47/100

Description

The Import JSON/CSV plugin imports structured JSON and CSV data into notes by turning each row or object into a separate file through a Handlebars template. It can read local files or pull JSON from a URL, choose a nested field as the source, split child fields into separate notes and build note names from field values or small JavaScript expressions. The import flow also supports prefixes, suffixes, folder paths and rules for appending or overwriting existing notes. CSV parsing detects common delimiters automatically and exposes field details in the developer console. For larger datasets, it includes batch processing so one source file can be imported in multiple passes with different destination folders, naming rules and template sections.

Reviews

No reviews yet.

Stats

stars
76,478
downloads
0
forks
36
days
NaN
days
NaN
days
0
total PRs
0
open PRs
0
closed PRs
0
merged PRs
0
total issues
0
open issues
0
closed issues
0
commits

Latest Version

Invalid date

Changelog

README file from

Github

Import JSON/CSV

ko-fi patreon paypal Latest Release Download Count GitHub License

Instructions

This plug-in provides you with the tools to import your favourite JSON and CSV table and create a set of Obsidian notes from that table. One note will be created for each row in a CSV file, or each object in a named array within the JSON file.

A magnifying-glass icon will appear in the left margin when this plug-in is enabled.

Clicking the icon will open a dialog window with some fields:

  • "Choose JSON/CSV File" will allow to you pick any .json or .csv file.

  • "Specify URL to JSON data" will allow you to enter the URL of a web location from which to retrieve some JSON data.

  • "Choose TEMPLATE File" will allow you to choose any .md file, which should be a Handlebars template file.

  • "Choose HELPERS File" will allow you to specify a separate .js file which contains additional handlebars helper functions (see below).

  • "Field containing the data" is used with a JSON file if a child of the top object should be used as the source of data instead of the very top of the JSON object.

  • "Each subfield is a separate note" can be set to indicate that the JSON object identified by "Field containing the data" actually contains a separate field for each note to be created (rather than the JSON object being an array).

  • "Field to use as Note name" will allow you to specify the JSON field/CSV column within each row of the table which should be used as the name of the note. Optionally, the name can be constructed from more than one field in the record/row using "${field}" to denote each field in the overall name pattern, for example "${country}-${town}".

-- Alternatively, the name can be constructed using a small amount of javascript by wrapping the JS code as @{...js...} which should contain a return statement providing the name (the JS code can reference this.field for fields within the current record being processed, or dataRoot.field to access anything within the overall JSON file.)

  • "Add suffix on duplicate Note Names" will append a number to the note name if the same name is found more than once in the import data (it will NOT avoid conflicts with Notes that existed in the Vault before the import).

  • "Note name prefix/suffix" allows optional text to be put at the start (prefix) and/or end (suffix) of the name of the created Notes.

  • "Allow paths in Note name" will create "/" in the given note name to be used to create folders within your vault. If not selected, then any occurrence of "/" will be replaced by "_".

  • "How to handle existing Notes" is available when you want to overwrite, or append to, existing notes already in your vault.

  • "Name of Destination Folder" allows you to set the top-level folder name within your Vault into which all the notes will be placed.

When the IMPORT button is pressed then the JSON/CSV file will be read and all the notes created.

Arrays inside arrays

If you have a JSON structure which has a top-level array in which each record contains an array, you can create a separate note for each of the nested arrays by specifying the path in the "Field containing the data", using a variable name for the array index (the variable name becomes available as @variablename in the MD file).

For example, setting the field to logs[logid].logEntries where logEntries is also an array, will create a note for each entry in the logEntries array of every entry in the higher logs array; and the MD file can access fields in the higher logs[] array using (in this case) the prefix @logid to reference the actual contents of the array, it is NOT an index. (e.g. @logid.title)

The array element reference can be used in the note name:

  • The ${} syntax can be used like ${@logid.title}-${title}.
  • For the function @{} syntax, the array index must be referenced using a prefix of impdata - so in the above example, the note name code could use impdata.logid.title.

Yes, it should be possible to access multiple nested levels of arrays.

Notes

If your Handlebars template file tries to reference something in the JSON data which isn't a simple text field, then the generated note will contain the text [object Object].

A notice will appear for each such note, but opening Obsidian's dev window (on MS Windows use Ctrl+Shift+i) will also show the list of affected notes.

The CSV decoder should auto-detect the actual separator from any of: comma, tab, pipe, semicolon, ASCII record separator (30), ASCII unit separator (31). (Blank lines in the CSV file will be ignored.)

Ensure that column names in CSV files contain only characters which make valid JSON variable/field names as required by Handlebars (e.g. no spaces or periods).

For CSV decoding, the list of detected delimiter, linebreak, and fields (column names) are displayed in the Obsidian Developer Console.

You can set up an Obsidian Hotkey to open the dialog, if you don't want to use the icon in the left bar.

The importer will only read the first object from the supplied JSON file. (So won't, for example, import a full set of entries from a Foundry VTT db file.)

Batch Processing

If multiple passes are required on the source file in order to create all the notes, then a batch file can be generated to automate multiple passes. The batch file is a JSON file containing a single array with one or more objects as elements.

Each element defines how the parameters of the parse should change for this and future iterations. (If a field is omitted from a later element of the array, then the last set value in an earlier array element will remain in force.)

  • "fieldName" - sets a new value for "Field containing the data".
  • "noteName" - sets a new value for "Field to use as Note name".
  • "folderName" - sets a new value for "Name of Destination Folder in Vault".
  • "namePrefix" - sets a new value for "Note name prefix".
  • "nameSuffix" - sets a new value for "Name name suffix".
  • "batchStep" - a string which can be read in the handlebars template file with @importBatchStep to select the appropriate section of the handlebars template file. (It will be an empty string if not explicitly set in a particular element of the batch array).

The handlebars template file can use {{#if (eq @importSettings.topField "pack.burgs") )}} or similar to then select the correct part of the template file to use for each iteration through the batch file.

An example batch.json file is:

[
    {
        "fieldName": "pack.burgs",
        "noteName": "@{return `${(this.state > 0) && dataRoot.pack.states.find(state => state.i === this.state)?.name || \"Unknown\" }-${this.name}`}",
        "folderName": "import/burgs"
    },
    {
        "fieldName": "pack.states",
        "noteName": "name",
        "folderName": "import/states"
    }
]

New Handlebars variables

Various top-level variables can be accessed to get information about the conversion being undertaken:

  • @importSourceIndex: If the source data is an array (which is always the case for CSV files) this will be the index into the array, otherwise it will be the name of the field within the 'Field containing the data' object which is being used to create the current note.
  • @importDataRoot: Is the entirety of the JSON file that was loaded (in case you need to access anything that is outside of the element currently being converted into a Note).
  • @importSourceFile (File: the source file containing the CSV/JSON data [.name and .path are available])
  • @importHelperFile (File: the file containing the JS handlebars helpers [.name and .path are available])
  • @importSettings (Values from the Dialog window)
    • @importSettings.jsonName: (string) "Field to use as Note name"
    • @importSettings.jsonNamePath: (boolean) "Allow paths in Note name"
    • @importSettings.jsonUrl: (string) "Specify URL to JSON data"
    • @importSettings.folderName: (string) "Name of Destination Folder in Vault"
    • @importSettings.topField: (string) "Field containing the data"
    • @importSettings.notePrefix: (string) "Note name prefix"
    • @importSettings.noteSuffix: (string) "Note name suffix"
    • @importSettings.handleExistingNote: (integer) "How to handle existing Notes"
    • @importSettings.forceArray: (boolean) "Each subfield is a separate note"
    • @importSettings.multipleJSON: (boolean) "Data contains multiple JSON objects"
Additional fields for JavaScript used in creating a note name dynamically.

The following variables are available inside the javascript which

  • this.SourceIndex: If the source data is an array (which is always the case for CSV files) this will be the index into the array, otherwise it will be the name of the field within the 'Field containing the data' object which is being used to create the current note. This has been superceded by @importSourceIndex.
  • this.dataRoot : contains the entire object defined by the JSON file selected for import.
  • this.SourceFilename : references the filename from which the JSON data was read.

Additional Handlebar Functions

When building handlebars template files, you will have access to all the handlebars-helpers

New Handlebar Functions

Table Lookup

A new inline helper "{{table" is available. It is used to lookup a value in a static look-up table and replace it with another value.

  • The first parameter is the value to be translated into another value.
  • value1 is the value to be compared to the lookup value.
  • result1 is the result of the {{table}} helper if the lookup value is equal to value1
  • value2 result2 = second set of possible matches
  • etc, as many pairs of value/result as you need. (any/all of the lookup value and value/result values can be fields or fixed strings)
  • value* can contain a javascript regular expression
  • result* can contain capturing groups (e.g. $1) to copy information from the matching string.
{{!-- {{table "blue" "red" "angry" "blue" "sad" "yellow" "envious" "green" "happy"}}   --}}
{{!-- will be converted into the string 'sad'  (taking "blue" and looking for the value/result pair that matches) --}}
{{table lookup value1 result1 value2 result2 value3 result3}}
substring

{{substring string start length}}

This will return a string containing the part of 'string' starting at offset start (0=first letter) and will return 'length' characters from that offset (if the string is shorter than start+length, then the remainder of the string will be returned).

{{substring "HAROLD" 3 2}}
{{!-- will return the string "OL", since 3 corresponds to the fourth letter in the string, and 2 refers to the number of characters to return starting at that position. --}}
strarray

{{strarray "HAROLD"}}

Converts the supplied string into an array of characters; primarily for use with #each to iterate over each letter in a string.

replacereg

{{replacereg string regexp replace}}

This searches 'string' for any matches with the regular expression 'regexp' string provided (do NOT use toRegExp, just provide the string), and replaces each occurrence with the 'replace' string (the 'replace' string can contain place markers from the regexp string).

strsplit

{{strsplit string separator}}

This splits 'string' at all occurrences of 'separator' (which may be a Regex) and returns an array containing all the parts of the string.

If the separator is a regex then you can include () around the regex to include the separator in the array of output strings (note that the separator is a separate element in the array).

setvar

{{setvar varName varValue}}

This assigns varValue to a local variable called varName (it will be created if it doesn't already exist). Usually varName will be a string, so it will need to be wrapped in double-quote marks.

The variable can be used later in the handlebars template using the expression {{varName}}

The {{setVar...}} function itself does not put any string into the generated output.

Adding your own Handlebars Helpers

You can specify an optional "HELPER" file, which should contain some javascript containing your additional handlebars helpers. See https://handlebarsjs.com/api-reference/helpers.html for more information.

An example helpers.js is:

function hb_farling() {
    let orig = arguments[0];
    orig += ' from Helper';
    return orig;
}

handlebars.registerHelper('farling', hb_farling);

The important component is to call handlebars.registerHelper with the name of the helper and the function that is implementing the helper. It is a good practise to prefix the name of the helper functions with hb_ to ensure that they don't conflict with other function names in the module. (Note that it is YOUR responsibility to ensure that the javascript in the helper functions don't break your Obsidian vault.)

which would allow the following to be specified in your template MD file:

{{farling 'Some Text'}}

Similar Plugins

info
• Similar plugins are suggested based on the common tags between the plugins.
Get Info
5 years ago by Chetachi
A small menu that is tucked inside your status bar and shows helpful information for your chosen file 📄.
Local File Interface
5 years ago by qawatake
An Obsidian plugin to provide commands for moving files in and out of the vault
Remember File State
4 years ago by Ludovic Chabant
A plugin for Obsidian that remembers cursor position, selection, scrolling, and more for each file.
Obsidian Dynamic Embed
4 years ago by Ivaylo Dimitrov Dabravin
File Cleaner
4 years ago by Johnson0907
A file cleaner plugin for Obsidian.
Nuke Orphans
4 years ago by Sandorex
Obsidian notes plugin that trashes orphaned files and attachments
Bellboy
4 years ago by Shaked Lokits
Opinionated file structure manager for the Obsidian knowledge base.
Note Auto Creator
4 years ago by Simon T. Clement
An Obsidian plugin for automatically creating notes when linking to non-existing notes
Redirect
4 years ago by Jacob Levernier
An Obsidian plugin for adding aliases to any file
Metadata Menu
4 years ago by mdelobelle
For data management enthusiasts : type and manage the metadata of your notes.
File Cooker
4 years ago by iuian
An obsidian plugin for moving search files to target folder
Janitor
4 years ago by Gabriele Cannata
Performs various maintenance tasks on the Obsidian vault
Edit Gemini
4 years ago by Basil_Mori
Emo
4 years ago by yaleiyale
Use image/file hosting in Obsidian by clipboard or draging file. Obsidian 图床聚合 & Github上传器
Aggregator
4 years ago by SErAphLi
This plugin helps you gather information from files, and make a summary in the file.
Workona To Obsidian
4 years ago by Holmes555
Plug-in for Obsidian.md which will import Workona json file
Review Notes Plugin
4 years ago by tjandy98
File Color
4 years ago by ecustic
An Obsidian plugin for setting colors on folders and files in the file tree.
Weekly Review
4 years ago by Brandon Boswell
🪝 Grappling Hook
4 years ago by pseudometa
Obsidian Plugin for blazingly fast file switching. For those who find the Quick Switcher still too slow.
Open files with commands
3 years ago by Lost Paul
Create commands that only open one file at the time and that can be used with the commander plugin.
Home tab
3 years ago by Renso
A browser-like search tab for your local files in Obsidian.
Open In New Tab
3 years ago by patleeman
Meld Build
3 years ago by meld-cp
Write and execute (sandboxed) JavaScript to render templates, query DataView and create dynamic notes.
File Diff
3 years ago by Till Friebe
View the difference between two files within Obsidian.
Auto Template Trigger
3 years ago by Numeroflip
An obsidian.md plugin, to automatically trigger a template on new file creation
Financial Doc
3 years ago by Studio Webux
Financial Documentation and Tracking using CSV format and Chart.js directly in Obsidian
Importer
3 years ago by Obsidian
Convert your data to Markdown files you can use in Obsidian. Works with Apple Notes, OneNote, Evernote, Notion, Google Keep, and many other formats.
Git Url
3 years ago by khuongduy354
Ruled template
3 years ago by YPetremann
An obsidian plugin that check rules to select which template to use.
Micro templates
3 years ago by epszaw
Flexible embedded micro templates powered by javascript functions
SyncFTP
3 years ago by Alex Donnan
An Obsidian.md plugin that allows users to add their own SFTP host and credentials to sync to and from.
Easy Bake
3 years ago by mgmeyers
Compile many Obsidian notes down to one.
Codeblock Template
3 years ago by Super10
A template plugin that allows for the reuse of content within Code Blocks!一个可以把Code Block的内容重复利用模板插件!
Search Templates Library
3 years ago by Pentchaff
Obsidian plugin that allows to store searches templates for later use, and displays search results both in the search view and graph view.
Tags Overview
3 years ago by Christian Wannerstedt
Obsidian plugin which adds an extended tags panel where tagged files can be overviewed, filtered and accessed in an easy way.
File Tree Generator
3 years ago by Unarray
An Obsidian extension to generate a file tree using callouts!
CSV Codeblock
3 years ago by elrindir
Plugin for obsidian to render csv syntax in codeblocks.
Frontmatter generator
3 years ago by Hananoshika Yomaru
A plugin for Obsidian that generates frontmatter for notes
JSON table
3 years ago by Dario Baumberger
Simply switch between JSON and tables in your Obsidian notes.
Sort Frontmatter
3 years ago by Kanzi
Sort frontmatter automatically
Incomplete files
3 years ago by Hananoshika Yomaru
Rule based incomplete files discovery
Neighbouring Files
3 years ago by Fabian Untermoser
Obsidian Plugin to navigate to the next and previous file in the current directory
YouTube Template
3 years ago by sundevista
📺 A plugin that would help you to fetch YouTube videos data into your vault.
Templated daily notes
2 years ago by digitorum
Allow to create templayted daily note in specific folder
Image Collector
2 years ago by tdaykin
Markmap to CSV
2 years ago by maxlee
obsidian plugin for conversion from markmap to csv
Fuzzy Note Creator
2 years ago by HaloGamer33
An Obisidan plugin for quickly creating notes with the help of a fuzzy finder. Now with templates!
Query JSON
2 years ago by rooyca
Read, query and work with JSON inside Obsidian.
Templify
2 years ago by Boninall
A releases repo for custom editable template in Obsidian.
SQLSeal
2 years ago by hypersphere
Query your files using SQL directly from your Obsidian Vault
Smart Templates
2 years ago by 🌴 Brian Petro
Smart Templates is an AI powered templates for generating structured content in Obsidian. Works with Local Models, Anthropic Claude, Gemini, OpenAI and more.
Confluence Link
2 years ago by Razvan Bunga
Convert obsidian md file into confluence pages
Structured Tree
2 years ago by Marius Svarverud
A file explorer for navigating hierarchical notes separated by '.'
Pug Templates
2 years ago by Nicholas Wilcox
An Obsidian plugin that enables the usage of Pug templates.
Templater
6 years ago by SilentVoid
A template plugin for obsidian
Find orphaned files and broken links
6 years ago by Vinzent
Find files, which are nowhere linked, so they are maybe lost in your vault.
Automatically reveal active file
6 years ago by Matt Sessions
Obsidian plugin to reveal the active file automatically when you open a file
Checklist
5 years ago by delashum
File path to URI
6 years ago by Michal Bureš
Convert file path to uri for easier use of links to local files outside of Obsidian
JSONifier
6 years ago by Kjell Connelly
CSV Editor
5 years ago by death_au
Edit CSV Files in Obsidian
Buttons
5 years ago by Sam Morrison
Buttons in Obsidian
Hotkeys for templates
5 years ago by Vinzent
Charts View
5 years ago by caronchen
Data visualization solution in Obsidian, support plots and graphs.
Liquid Templates
5 years ago by Diomede Tripicchio
Define your templates with LiquidJS tags support
Static File Server
5 years ago by Elias Sundqvist
Serve obsidian vault subfolders with a static web server
File Tree Alternative
5 years ago by Ozan Tellioglu
This Obsidian Plugin allows users to have a different file explorer experience.
CSV Table
5 years ago by Adam Coddington
Have a CSV file you want to render some or all of the data from? This plugin allows you to display that data in your obsidian preview.
Advanced New File
5 years ago by Ivan Chernov
Create file in chosen folder
File Explorer Note Count
5 years ago by Ozan Tellioglu
Obsidian Plugin for viewing the number of elements under each folder within the file explorer
Daily Named Folder
5 years ago by Nemo Andrea
Like daily note, but nested in a daily folder and some more improvements
From Template
5 years ago by mo-seph
Simple plugin to create Notes from a template, and fill in fields defined there
Symlink Creator
2 years ago by Tobias Heidler
A plugin for Obsidian that allows the creation of symlinks - for Windows, OS X and Linux only!
Modal Opener
2 years ago by Muuxi
Open files and links in modal windows, or create and edit compatible files in modal windows.
Ffmpeg Converter
2 years ago by MrAnyx
Convert your assets into other formats. Convert, Compress and Optimize your vault
Advanced Copy
2 years ago by leschuster
An Obsidian plugin to copy Markdown and transform it into HTML, Anki, or any custom format. Create custom profiles with versatile templates tailored to your workflow.
Fold Properties
2 years ago by James Alexandre
Adds Fold/Unfold Properties Function to Folder Context Menu
Nav Weight
2 years ago by shu307
A simple plugin designed to sort files in navigation based on markdown frontmatter (also known as metadata) for Obsidian.
File Manager
2 years ago by Juan Sicilia
A file manager plugin for Obsidian
Folder Tabulation
2 years ago by SpeedaRJ
An open source plugin for obsidian that let's you treverse local folder structure via keybindings and commands.
Auto File Organizer
2 years ago by mofukuru
Obsidian plugin: Automatically organizes files into folders based on their extensions.
Visual Crossing Weather
2 years ago by willasm
Template by Note Name
2 years ago by Jacob Learned
A simple Obsidian plugin to automatically template notes based on their title
Data Files Editor
2 years ago by ZukTol
Obsidian.md plugin for editing text data files
Varinote
a year ago by Giorgos Sarigiannidis
A plugin for Obsidian that allows you to add variables in Templates and set their values during the Note creation.
CSV All-in-One
a year ago by hihangeol
Note to RED
a year ago by Yeban
一键将 Obsidian 笔记转换为小红书图片进行导出
Open in GitHub
a year ago by Muurphy Chen
This is an Obsidian plugin designed to open project or files directly in GitHub via your browser.
Daily Notes Automater
a year ago by David Pedrero
Template Filename
a year ago by Callum Alpass
Obsidian plugin for creating notes with templatable filenames
Course Module Loader
a year ago by Sebastian Kamilli
Downloads and unzips course module zip files from a URL into a specified vault folder, skipping existing files.
Character Sheets
a year ago by Grayvox
📝Create character sheets for your very own traumatized little guys with Obsidian.
Simple Vault Importer
a year ago by WebInspectInc
WebDAV Image Uploader
a year ago by ste
Uploads, downloads and deletes images on WebDAV server within Obsidian notes.
Custom Comments
a year ago by Jack Chronicle
Adds a method to create custom methods to enclose comments
Emoji selector
10 months ago by summer
Insert custom emojis with quick search, auto-suggestions, and customizable templates.
Default Template
7 months ago by raeperd
obsidian plugin to set default template for new notes
Handlebars Dynamic Templating
6 months ago by Hide_D
Handlebars dynamic templating. Define template files and use them dynamically via hb blocks. Template recursion is also possible.
LongtimeDiary
5 months ago by sawamaru
Show past Daily notes on the same day in previous years.
Bases Toolbox
15 days ago by Grub Basket
Quality-of-life tools for Bases and properties: find & replace property values across the vault, stop number properties from changing on arrow keys, and a searchable index of every property. - This plugin has not been manually reviewed by Obsidian staff.
Image Converter
11 days ago by xryul
Convert, compress, resize, annotate, markup, draw, crop, rotate, flip, align, drag-resize, rename with variables, and batch process images: WEBP, JPG, PNG, HEIC, TIF
Power Tables
9 days ago by Power Plugins
Color, calculate, and sort Markdown tables in place: cell fills and text colors, live formulas that recalculate, and column sorting, all stored as plain Markdown. - This plugin has not been manually reviewed by Obsidian staff.
Note Types
6 days ago by jsmorabito
Define note types with creation commands, filtered file pickers, hover previews, styled wikilinks, and a sidebar widget. - This plugin has not been manually reviewed by Obsidian staff.
Dayframe
5 days ago by Ganessh Kumar R P
like a picture frame but for your daily notes. - This plugin has not been manually reviewed by Obsidian staff.
Granola Meetings Simple Sync
2 days ago by philfreo
Sync your Granola meeting notes, summaries, and transcripts to your vault in a simple way using the official Granola MCP API. Customizable by template. Supports auto-linking of attendee Person notes. - This plugin has not been manually reviewed by Obsidian staff.