![]() ![]() It's not officially affiliated with the Anki project but seems to have a cleaner and more well-documented API, in addition to a more liberal licence. When using the API, it's also helpful to be familiar with some of the basic concepts: Genanki The official documentation isn't comprehensive, but I've also documented it a little bit myself: The official Anki python API is documented here: # Save and export the collection to an Anki package (.apkg) fileĮxporter = AnkiPackageExporter(collection)Įxporter.exportInto('/path/to/test.apkg')) Importer = TextImporter('/path/to/test.csv')) # Import cards from CSV into the new collection # Create a new deck in the collection (otherwise the "Default") deck will be usedĭeck_id = ('Deck name') Here's a very basic example to import from CSV and export a deck to an Anki package (.apkg) file: import ankiįrom import TextImporterĬollection = anki.Collection('/path/to/test.anki2')) To build on gavenkoa's answer, the Anki API has built-in functionality to import from CSV.įirst of all, you can install the anki Python package using pip, e.g.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |