This is now possible as of Anki 2.1.54 as per this documentation
Here is the procedure:
- Sort your csv file so that every deck is in alphabetical order.
Otherwise you will end up with hundreds of decks named: deck++++++++++++++
- Edit the top of your csv file using a text editor like notepad, not excel.
- Add the following line:
#deck column:2 to the very top of the file. The # is required.
- Change the column number to the column with the deck name
You will know this is working correctly, when the import dialogue has the deck field greyed out when you go to select which field is which.
Notes:
- As far as I know the decks have to be in the format
TopDeck::Sub::Sub2 with the old :: between lines.
- Make sure you have a top deck name, so the cards don't end up scattered everywhere.
Re-importing:
If you would like to make changes to a deck in csv, you have to set the GUID for each card so you don't end up with duplicates.
- Add the following line:
#guid column:1 to the very top of the file. The # is required.
- Then specify a custom string of letters and numbers for each card. For my Advanced Spanish Deck, I took the NID of each card directly from Anki, processed it with Python to clean it up a bit and remove images, and then prepended "ASW" on the front of each NID to create a unique string so that Anki will recognize the cards even if I change the front somehow.
- If you change a card's subdeck in the csv after importing, it will not change when imported again into Anki. The only way I know to fix this is to completely delete the anki cards and then reimport them all from csv again.
Example:
Here are the first 3 lines of a working csv ready to be imported into anki. I'm using semicolon as a delimiter for easy importing.
#guid column:1
#deck column:2
ASW1321299137982;Advanced Spanish Words::Adj & Adv;Llano (Adj);Flat, plain (adj);2;