Contents
Anki allows you to import material from a number of sources:
- Comma, semicolon and tab-separated text files
Decks created with Mnemosyne.
- Decks created with Anki
Text Files (Comma, semicolon or tab-separated)
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.xcl, myfile.rtf, myfile.doc must be saved as a plain text file first.
- 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
Encoding
Files must be saved in UTF8 format. If you're on a Mac, your text editor may be saving the file in a different format. See the following for more information:
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.
After you've copied the files, change one of the fields in your text file as follows.
For images:
<img src="myimage.jpg">
For audio:
[sound:myaudio.mp3]
After importing, run Tools>Advanced>Check Media DB to get Anki to checksum your files for you. If you don't do this and your files have foreign characters in them, things may break.
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:
[sound:%(text:myfieldname)s]
Using Gnumeric to make text files
Save as=> Text Export (configurable), then in a new window under "Separator" select "Tab".
Suggestions for importing data from spreadsheets on Windows machines
- After constructing a model in Anki, assemble the data in your spreadsheet such that each column represents each field in your model and each row represents one new fact.
- Ensure that there are no empty cells in the first row in your spreadsheet.
- Highlight the data in your spreadsheet and copy into a new text file using Notepad.
- Save the file using UTF-8 encoding.
- In Anki, click Deck and then Import...
- Select the correct model and choose the file to import.
- Ensure that the field mapping is correct.
- Click import.
