farling42 / obsidian-import-json

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

Feature Request - Retain all previous settings to repeat last import? (JSON/CSV file, Helpers files) #61

Open buttonpushertv opened 7 months ago

buttonpushertv commented 7 months ago

Due to the nature of needing to make multiple revisions of templates to get things correct, is there a way to retain all the settings for an import to use them over again without being forced to go through the steps to load the JSON/CSV file, load the Handlebar Helper file, and load the Custom Helper JS file? Much the same way that it retains the import settings starting with 'Field containing the data` and below on the import dialog, it would be nice if the top fields could be retained with the previous settings used so that an import could just be re-run quickly.

If there was a checkbox to "latch" the previous import settings, maybe that could be a way to ensure that the user was making the choice to re-run with all the same settings.

Thanks.

farling42 commented 7 months ago

Unfortunately, due to the limitations of Obsidian actually just using a browser (electron) front-end, there's no way for apps to store a "File" object and have it repopulate the dialog box when it is next opened.

buttonpushertv commented 7 months ago

Out of curiosity, is it possible to call the import process via a console command (that could be repeated)? Obviously there would need to be a way to create a valid set of settings to feed to the console,but could that be a way to repeat an import process without all the repetition?

farling42 commented 7 months ago

See #30 for the request to allow the import to be triggered from a macro.

buttonpushertv commented 7 months ago

That issue tells of how you can trigger from a Hotkey, but is there a way to trigger the import similar to a command line with arguments? Maybe from the console?

See #30 for the request to allow the import to be triggered from a macro.

farling42 commented 5 months ago

See #66 which is an Enhancement Request to support accessing files within a Vault

buttonpushertv commented 2 months ago

Clarifying this, what I was thinking was if there is a way to construct the importSettings object via a JavaScript code block or console command?

Rather than using the importer's dialog to enter the fields, I'm wondering if a way around the lack of saving of settings would be to enter the data into an object and then feed that into the importer via the console or JavaScript (which could be called via QuickAdd or Templater)?

The goal here is to allow several passes of import to be turned into more of a scripted set of passes instead of manually running each pass individually and making those few small changes to Handlebar Templates, JSON fields to pull from, and import destinations needed for the different passes on the same JSON file and same Helper.js.

farling42 commented 2 months ago

Version 0.37.0 provides the ability to parse more than one section of the JSON file.

It isn't possible for any Javascript application to make a copy of a reference to a specific file on your computer, and there is no workaround for it (otherwise any dubious Web site would be using that trick).

elvarb commented 1 month ago

Would be great if you could save an import job so you can recall it.

I think an implementation could be similar as how Supercharged Links does it. When you open Supercharged Links settings you get a list of all predefined stylings, and when clicking new you get a dialog box similar to the import job in this plugin.

That solution could also open up the possibilities of using other plugins to call a saved import job.