Importing takes content from files, and places it in the currently open deck. You can import material from a number of sources:

  • Text files

  • Anki decks

  • SuperMemo

  • Mnemosyne

  • CueCard

  • DingsBums

Text Files

The Basics

Any plain text file that contains fields separated by commas, semicolons or tabs can be imported into Anki, provided some conditions are met.

  • The files must be plain text (myfile.txt). Other formats like myfile.xls, myfile.rtf, myfile.doc must be saved as a plain text file first.

  • The files must be in UTF-8 format (see below)

  • Anki determines the number of fields in the file by looking at the first (non-commented) line. Any other lines in the file which don’t match this number will be ignored.

  • The first line also defines the separating character - if Anki finds a ; on the first line it will use that - if it finds a comma it’ll use that, etc.

This is an example of a valid file:

field1; field2; field3
foo bar; bar baz; baz quux

There are two ways to include newlines in fields.

Escape the multi-lines:

hello [tab] "this is
a two line answer"
two [tab] this is a one line one

Use HTML new lines:

hello [tab] this is<br>a two line answer
two [tab] this is a one line one

This is an example of a valid file where the first line is ignored (#):

# this is a comment and is ignored
field1; field2; field3
foo bar; bar baz; baz quux

HTML

Anki treats text imported from text files as HTML (the language used for web pages). This means that text with bold, italics and other formatting can be exported to a text file and imported again. But this also means that if you’ve accidentally included HTML characters in plain text, you’ll need to modify it.

Specifically:

  • < should be written as &lt;

  • > should be written as &gt;

You can use your text editor to do a find and replace on those characters if you use them.

Encoding in UTF-8

When a computer stores foreign characters in a file, it uses an encoding format. The most common format used these days is UTF-8. If you have download a file from the internet, or saved it using some editors, the file may not be encoded in UTF-8. Here’s how to convert a file to UTF-8:

Windows

  • Open the flat file in PSPad, TextPad, NotePad++, Crimson Editor, or an editor of your choice that lets you set the encoding format. Avoid the standard Notepad and Wordpad apps.

  • Click on Format, UTF-8

  • Save the file

OSX

  • Open the TextEdit application.

  • TextEdit>Preferences and in the New Document section, change the format to "Plain text"

  • File>New to create a new document with no formatting

  • Paste in the data you want to save

  • File>Save As and you’ll be given the option to save in UTF-8 format.

Importing Media

If you want to include audio and pictures from a text file import, copy the files into the yourdeckname.media folder. This folder is located in the same directory as your deck. If it doesn’t exist, you can create it. Do not use subdirectories, or some features will not work.

After you’ve copied the files, change one of the fields in your text file as follows.

<img src="myimage.jpg">

or

[sound:myaudio.mp3]

An alternative solution if you don’t want to edit your text file is to include the sound or image tag in the template. Go to Settings>Deck Properties>Edit>Card Templates, and in the question or answer format, add something like:

<img src="{{text:your field name}}">

or

[sound:{{text:your field name}}]

Then in the field called "your field name", the only text required is something like "somesoundfile.mp3" or "apicturefile.jpg".

Alternatively if the field name contains the first part of the filename but not the extension, you can add it like:

<img src="{{text:your field name}}.jpg">

or

[sound:{{text:your field name}}.mp3]

Adding Tags

If you want to add tag1 and tag2 to every line you’re importing, add the following to the top of the text file:

tags:tag1 tag2

Duplicates

Anki will use your per-field settings to determine whether duplicate entries should be added or not. See card layout for more information.

Spreadsheet Programs

It’s possible to edit your data in a spreadsheet program, then export that data to a text file so Anki can import it.

It’s recommended that you use OpenOffice.org, as it is free, runs on all major platforms, and handles exporting text files well. To save the document as a text file, use File>Save As, and choose Text CSV from the file type list.

Anki Decks

You can also import one Anki deck into another. Any models, templates and so on that are not in the currently open deck will be copied from the deck you’re importing. Duplicate cards are not copied, even if their wording has been changed.

New Card Order

The following presumes you have Anki set to show cards in the order they were added (see the study options).

When you import from a text file, new cards will appear in the order of the file.

When you import from an Anki file, new cards retain whatever previous ordering they had.