Is there a way to repack into a .apkg?

I tried a lot now with exporting my cards to share a custom template with friends. But somehow the template is not being carried over. I already looked with sqlitebrowser into the exported collection.anki2.
It appears, that the col table is only exporting the “Basic (type in the answer)” template in the “models” column, though I have no cards with this template in my .apkg exported. I don’t even use this template at all. What could this be?

I hope someone can help me with this.

  1. Is this something you’re noticing only by looking at the database, or is the issue that after import your notes are given the wrong note type?
  2. Are you looking at the database inside the apkg, or in the profile folder after you’ve imported it to Anki?
  3. Are you looking at collection.anki2 or collection.anki21?
  4. Are you sure you’re seeing all of the data in the models field?
1 Like
  1. Is this something you’re noticing only by looking at the database, or is the issue that after import your notes are given the wrong note type?

I tinkered a bit around. It apparently only doesn’t show in the sqlitebrowser but still imports the right note type. A few hours ago it somehow only exported half of the note type. I probably hit some wrong settings or catched the wrong deck maybe.

  1. Are you looking at the database inside the apkg, or in the profile folder after you’ve imported it to Anki?

I am indeed looking at the database inside the apkg. I unziped it and then dragged the .anki2 into the sqlitebrowser.

  1. Are you looking at collection.anki2 or collection.anki21?

At collection.anki2

  1. Are you sure you’re seeing all of the data in the models field?

I am now sure - after some testing - that I indeed don’t see every data in the ‘models’ column. Else it doesn’t make sense, why the note type is now being imported. Shouldn’t the template at least somehow show up in there?

Okay. I found this thread (now…): Collection.anki2 in exported .apkg file

Apparently all my notetypes and cards are in .anki21.
But I somehow cannot unzip it. I am gonna try my luck with the ztsd standard, as mentioned in the linked post.

So… for the future (if anyone ever stumbles upon this thread):
If anyone need to unzip a .anki21 file, he would have to only install GitHub - mcmilk/7-Zip-zstd: 7-Zip with support for Brotli, Fast-LZMA2, Lizard, LZ4, LZ5 and Zstandard and then unpack it.

Pull the information from the then extracted “collection” file. And boom you can see everything you ever dreamed of.
The only Problem for me now: Is there a possibility to repack this file back into a .anki21 and then into a .apkg file?

.apkg files were not intended to be read/written by software other than Anki. If you must access them, you should use the Python API instead: The 'anki' Module - Writing Anki Add-ons

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.