Feature request: Creating new decks from "Import->Text file" screen

I use AnkiDroid without other Anki instances and add notes either manually or using CSV (text) import.

Using text file import usually goes like that:

  1. Open Anki. Press “Import → Text file (.txt, .csv)”.
  2. Choose the file.
  3. Inspect the preview to ensure that it has guessed field arrangement correctly.
  4. Notice that it would append to existing deck instead of creating a deck.
  5. Press “Deck” combobox chooser. Scroll it to and fro.
  6. Wonder “hey, where is ‘create new deck’ option?”.
  7. Abort importing using the back button
  8. Create a deck using floating action button menu.
  9. Press “Import → Text file” again.
  10. Choose the file again.
  11. Check preview again
  12. Choose the newly created deck from the “Deck” chooser (requires meticulous scrolling though numerous decks - the new deck is not the default).
  13. Finally import.
  14. Review the import result.

I suggest there to be some “[create new deck]” option in the “Deck” chooser. It should ask user to input the name of the deck, with a filename stem being the default name.

Some filename character (e.g. .) may be converted to :: to aid easy subdeck creation.

@sorata Why this post has been moved from AnkiDroid-specific category to general Anki one?

Isn’t UI of the import dialog platform-specific?

Anki already provides a feature for that. Try creating a deck column. Text Files - Anki Manual.

It’s shared among all the clients.

Thanks for the suggestion.

I tried creating a sample file qqq.txt with this content:

#deck:sample333
aaa;sss

Upon importing attempt the first line was indeed ignored (at least in the preview).

But deck chooser still showed other unrelated deck. And actually importing it indeed added the note to that deck instead of creating sample333.

Where is the mistake?


Linked documentation states:

deck | Deck name or id | Presets the deck, if it exists.

How to create a new deck by importing then?

It’s that you mistook “deck column” for a file header. I don’t blame you though, that part of the docs is confusing even to me.

So, you’re supposed to use the file header to mark a column and the column will contain deck name for every row (notes).


You are looking at the wrong one. Try using deck column not deck.

1 Like

Indeed, this file:

#deck column:1
sample333;aaa;sss

resulted in “Deck” chooser being absent from import dialogue and it created the deck as expected.


Why deck: does not work the same way as deck column:? Maybe it should be equivalent to having a deck column: column with specified value repeated for each row?

I have no idea to be honest. Maybe dae will know.

This works fine for me on Desktop. If it doesn’t work on AnkiDroid, maybe it’s a bug on their end?

Edit: Nevermind, I overread this statement of yours:

#deck:1 will select a deck with the id 1, or if it doesn’t exist, a deck with the name 1. Extending it to refer to column numbers in addition to deck ids isn’t intuitive, so #deck column is used to disambiguate.

Unless you’re referring to why #deck:... won’t create a new deck

I think that’s it. Do you happen to have an idea? To me, it seems logical that both, deck and deck column, should do the same thing (in this case: creating a deck if it does not exist, else select it).

3 Likes

@Rumo I vaguely recall us talking about it at the time - does your memory agree? If so, @Anon_0000 may be able to find the answer in the original PR discussion.

Thanks for narrowing it down, dae.

Rumo indeed asked this question in Plaintext import/export by RumovZ · Pull Request #1850 · ankitects/anki · GitHub :

  1. If a deck or notetype can’t be resolved, the question is again whether to skip the note, use the default deck/notetype, or abort.

But I don’t think it had been answered / decided on. I might have overlooked it though. The PR discussion is quite huge and many files had been modified.

Maybe it was just an oversight that deck and deck column behave different and it wasn’t intended?

I don’t remember. I’m having trouble thinking of a good reason for the inconsistency though, so if no one chimes in soon, no objections to changing it.