Addon import csv file [Help] [Solved]

In my addon I want to import a csv file, which was created by Anki, using mw.col.export_note_csv()

I tried various things, but nothing really worked.

  • TextImporter only works on a basic level with front <separator> back, at least with the default options.
  • CsvImporter.do_import() works theoretically, but the user has to interact with an interface.
  • ImportCsvRequest sounds like the way to go, but requires a CsvMetadata object, which I can’t wrap my head around.

I also looked at addons that can import stuff, but Spreadsheet Import Plus, for instance, subclasses the NoteImporter and uses its own import-logic.

I don’t want to do any complex imports. I want to export a deck to a csv file and be able to import it again.

At this point, I have no idea where to continue. Any help is very much appreciated.

Something like col.import_csv(ImportCsvRequest(path=..., metadata=col.get_csv_metadata(...)))


Thank you very much, that worked!