Control csv file import via header "#key:value"

Hi,

According to the description of the Website “Importing - Anki Manual”, I set up the header of the csv import file as following:
#separator:tab
#html:true
#notetype:Italienisch
#deck:Italienisch

Independent whether “Legacy import/export handling” is checked or not, the import process is not reading the settings from the file.

Result:
Legacy import/export handling - not checked: HTML = False
Legacy import/export handling - checked: Stapel = Standard (instead of “Italienisch”)

Installed Version
Version 2.1.57 (6b7d372c)
Python 3.9.15 Qt 6.4.2 PyQt 6.4.0
All Addons were deaktivated and Anki was rebooted afterwards.

What can be the reason?

Best Regards,
Martin

It won’t work with the legacy importer. Can you share a screenshot after opening the file with the new importer?

Hi Rumo, thanks for looking at. The new importer looks much nicer, but there is another issue with the tags. Therefore I’m ussing the legacy importer from time to time. The issue with the tags I will describe in a seperate ticket.
I did before this test for you an import for “Italienisch - Verben”.
Enclosed please find the screenshot.for the import into “Italienisch”
2023-02-01 Screenshot from File Import|689x436

Works for me if I copy the header from your first post.
Is the HTML toggle in your screenshot disabled? Can you share the imported file?

In sreenshot “HTML toggle” is disabled, but it should be actived (#html:true).

Files “Italienisch.txt” and “Italienisch Beispiele.txt” can be imported via the legacy mode and via the new mode, however the determination via header is not working (new mode).
File “Italienisch Verben.txt” can only be imported via the legacy mode. Via the new mode it stucks after having changed the notetype.

For me it is not allowed to upload Textfiles, only screenshots. Therefore I copied the content into the communication:

“Italienisch Beispiele.txt”
#separator:tab
#html:true
#notetype:Italienisch - Beispiele
#deck:Italienisch - Beispiele
Dov’è la valigia piccola? Wo ist der kleine Koffer? [sound:Dov_è la valigia piccola.mp3] [sound:Wo ist der kleine Koffer_F3.mp3] Dov’è? - Wo ist? A-Kurs:01-Avanti!-Avanti! A-Kurs:02-Con-piacere B-Lek:01-01-La-valigia-der-Koffer B-Lek:02-A1-01-Piacere-di-conoscervi! C1-Tag:Fragewort D-Typ:Fragewort
La valigia è piccola. Der Koffer ist klein. [sound:La valigia è piccola.mp3] [sound:Der Koffer ist klein.mp3] piccolo, piccola - klein A-Kurs:01-Avanti!-Avanti! A-Kurs:02-Con-piacere B-Lek:01-01-La-valigia-der-Koffer B-Lek:02-A1-01-Piacere-di-conoscervi! D-Typ:Adjektiv
La valigia non c’è più. Der Koffer ist nicht mehr da. [sound:La valigia non c’è più.mp3] [sound:Der Koffer ist nicht mehr da.mp3] non c’è più - nicht mehr da A-Kurs:01-Avanti!-Avanti! B-Lek:01-01-La-valigia-der-Koffer C1-Tag:Doppelte_Verneinung D-Typ:Satzteil
C’è Anna? Ist Anna da? [sound:C_è Anna_F.mp3] [sound:Ist Anna da_F.mp3] c’è - es gibt, ist da A-Kurs:01-Avanti!-Avanti! B-Lek:01-01-La-valigia-der-Koffer D-Typ:Satzteil

“Italienisch Verben.txt”
#separator:tab
#html:true
#notetype:Italienisch - Verben
#deck:Italienisch - Verben
Konjugation: abbinare " - " verbinden [sound:abbinare.mp3] Verb Bezugsverb Konjugation: abitare - wohnen Konjugationsregel: regelmäßig auf -are “” “0” Indicativo presente - Präsens … Singolare Audio Plurale Audio 1. P. io abbino [sound:io abbino.mp3] noi abbiniamo [sound:noi abbiniamo.mp3] 2. P. tu abbini [sound:tu abbini.mp3] voi abbinate [sound:voi abbinate.mp3] 3. P. lui abbina, lei abbina [sound:lui abbina, lei abbina.mp3] loro abbinano [sound:loro abbinano.mp3] V1-Klasse:regelmäßiges-Verb V2-KonjKlasseVorlage:-Nein V3-KonjRegel1:regelmäßig-auf–are V4-KonjKlasse-Nr-01:-abitare
Konjugation: abitare " - " wohnen [sound:abitare.mp3] Verb Bezugsverb Konjugation: abitare - wohnen Konjugationsregel: regelmäßig auf -are “” “0” Indicativo presente - Präsens … Singolare Audio Plurale Audio 1. P. io abito [sound:io abito.mp3] noi abitiamo [sound:noi abitiamo.mp3] 2. P. tu abiti [sound:tu abiti.mp3] voi abitate [sound:voi abitate.mp3] 3. P. lui abita, lei abita [sound:lui abita, lei abita.mp3] loro abitano [sound:loro abitano.mp3] Indicativo passato prossimo - Perfekt … Passato prossimo Audio 1. P. Sg. io ho abitato [sound:io ho abitato.mp3] 2. P. Sg. tu hai abitato [sound:tu hai abitato.mp3] 3. P. Sg. lui ha abitato, lei ha abitato [sound:lui ha abitato, lei ha abitato.mp3] 1. P. Pl. noi abbiamo abitato [sound:noi abbiamo abitato.mp3] 2. P. Pl. voi avete abitato [sound:voi avete abitato.mp3] 3. P. Pl. loro hanno abitato [sound:loro hanno abitato.mp3] Indicativo imperfetto - Imperfekt … Singolare Audio Plurale Audio 1. P. io abitavo [sound:io abitavo.mp3] noi abitavamo [sound:noi abitavamo.mp3] 2. P. tu abitavi [sound:tu abitavi.mp3] voi abitavate [sound:voi abitavate.mp3] 3. P. lui abitava, lei abitava [sound:lui abitava, lei abitava.mp3] loro abitavano [sound:loro abitavano.mp3] Indicativo futuro semplice - Futur I … Singolare Audio Plurale Audio 1. P. io abiterò [sound:io abiterò.mp3] noi abiteremo [sound:noi abiteremo.mp3] 2. P. tu abiterai [sound:tu abiterai.mp3] voi abiterete [sound:voi abiterete.mp3] 3. P. lui abiterà, lei abiterà [sound:lui abiterà, lei abiterà.mp3] loro abiteranno [sound:loro abiteranno.mp3] Condizionale presente - Konditional I (würde …) … Singolare Audio Plurale Audio 1. P. io abiterei [sound:io abiterei.mp3] noi abiteremmo [sound:noi abiteremmo.mp3] 2. P. tu abiteresti [sound:tu abiteresti.mp3] voi abitereste [sound:voi abitereste.mp3] 3. P. lui abiterebbe, lei abiterebbe [sound:lui abiterebbe, lei abiterebbe.mp3] loro abiterebbero [sound:loro abiterebbero.mp3] Imperativo affermativo … Imperativo Audio - - - Tu-Form (2. Person Sg.) abita [sound:abita.mp3] Lei-Form (3. Person Sg.) abiti [sound:abiti.mp3] Noi-Form (1. Person Pl.) abitiamo [sound:abitiamo.mp3] Voi-Form (2. Person Pl.) abitate [sound:abitate.mp3] Höfliche-Form (3. Person Pl.) abitino [sound:abitino.mp3] Imperativo negativo … Imperativo Audio - - - Tu-Form (2. Person Sg.) non abitare [sound:non abitare.mp3] Lei-Form (3. Person Sg.) non abiti [sound:non abiti.mp3] Noi-Form (1. Person Pl.) non abitiamo [sound:non abitiamo.mp3] Voi-Form (2. Person Pl.) non abitate [sound:non abitate.mp3] Höfliche-Form (3. Person Pl.) non abitino [sound:non abitino.mp3] Participio - presente, passato, gerundio abitante [sound:abitante.mp3] abitato, abitata, abitati, abitate [sound:abitato, abitata, abitati, abitate.mp3] abitando [sound:abitando.mp3] V1-Klasse:regelmäßiges-Verb V2-KonjKlasseVorlage:-Ja V3-KonjRegel1:regelmäßig-auf–are V4-KonjKlasse-Nr-01:-abitare
Konjugation: accettare " - " annehmen [sound:accettare.mp3] Verb Bezugsverb Konjugation: abitare - wohnen Konjugationsregel: regelmäßig auf -are “” “0” Indicativo presente - Präsens … Singolare Audio Plurale Audio 1. P. io accetto [sound:io accetto.mp3] noi accettiamo [sound:noi accettiamo.mp3] 2. P. tu accetti [sound:tu accetti.mp3] voi accettate [sound:voi accettate.mp3] 3. P. lui accetta, lei accetta [sound:lui accetta, lei accetta.mp3] loro accettano [sound:loro accettano.mp3] V1-Klasse:regelmäßiges-Verb V2-KonjKlasseVorlage:-Nein V3-KonjRegel1:regelmäßig-auf–are V4-KonjKlasse-Nr-01:-abitare
Konjugation: aggiungere " - " hinzufügen [sound:aggiungere.mp3] Verb Bezugsverb Konjugation: dipingere - malen Konjugationsregel: unregelmäßiges Verb im passato remoto und participio passato “” “0” Indicativo presente - Präsens … Singolare Audio Plurale Audio 1. P. io aggiungo [sound:io aggiungo.mp3] noi aggiungiamo [sound:noi aggiungiamo.mp3] 2. P. tu aggiungi [sound:tu aggiungi.mp3] voi aggiungete [sound:voi aggiungete.mp3] 3. P. lui aggiunge, lei aggiunge [sound:lui aggiunge, lei aggiunge.mp3] loro aggiungono [sound:loro aggiungono.mp3] V1-Klasse:partiell-regelmäßiges-Verb V2-KonjKlasseVorlage:-Nein V3-KonjRegel2:unregelmäßiges-Verb-im-passato-remoto-und-participio-passato V4-KonjKlasse-Nr-32:-dipingere

“Italienisch.txt”
#separator:tab
#html:true
#notetype:Italienisch
#deck:Italienisch
il temporale das Gewitter [sound:il temporale.mp3] Substantiv C’è il temporale. Es gewittert. [sound:C_è il temporale.mp3] tempoˈraːle A-Kurs:01-Avanti!-Avanti! B-Lek:01-03-L-ombrello-der-Regenschirm D-Typ:Substantiv
avere paura di qcn / qc vor jdm / etw Angst haben [sound:avere paura di qualcuno, qualcosa.mp3] Verb Ho paura del temporale. Ich habe vor dem Gewitter Angst. [sound:Ho paura del temporale.mp3] Bezugsverb Konjugation: avere - haben Konjugationsregel: unregelmäßiges Verb paˈu:ra A-Kurs:01-Avanti!-Avanti! B-Lek:01-03-L-ombrello-der-Regenschirm D-Typ:Verb
avere qc etw haben [sound:avere qualcosa.mp3] Verb - mit direktem Objekt Non ho capito. Ich habe nicht verstanden. [sound:Non ho capito.mp3] Bezugsverb Konjugation: avere - haben Konjugationsregel: unregelmäßiges Verb aˈve:re A-Kurs:01-Avanti!-Avanti! A-Kurs:02-Con-piacere B-Lek:01-03-L-ombrello-der-Regenschirm B-Lek:02-A1-00-Benvenuti-in-Italia! D-Typ:Verb-mit-direktem-Objekt
piove es regnet [sound:piove.mp3] Satzteil piòwe A-Kurs:01-Avanti!-Avanti! B-Lek:01-03-L-ombrello-der-Regenschirm D-Typ:Satzteil
io ich [sound:io.mp3] Personalpronomen A-Kurs:01-Avanti!-Avanti! B-Lek:01-02-La-sedia-der-Stuhl D-Typ:Personalpronomen
tu du [sound:tu.mp3] Personalpronomen tu A-Kurs:01-Avanti!-Avanti! B-Lek:01-02-La-sedia-der-Stuhl D-Typ:Personalpronomen

Still works for me, but that’s to be expected if I just copy it. Can you upload the file somewhere else?
Or you can try typing the headers into a new file and see if that helps.

That was ambiguous from me. I meant, can you toggle the button? Does it change when you click it?

Since the statement “#html:true” is not read from file, I have to set it manually in the import screen. That is working.
I sent you three different files to import into the different decks with the “file name” = “deck name”. Let us take the file “Italienisch Verben.txt”.

  1. First screenshot after having selected “Import” and choosen the file “Italienisch Verben.txt”.

    Result:
  • HTML is not activated
  • Notetype and Deck are not picked as stated in the header of the file “Italienisch Verben.txt”.
  1. Activate HTML manually.

  2. Now I have to change the settings for Notetype and Deck
    After having changed Notetype to “Italienisch - Verben” the import screen is froozen and I cannot do anything. What is suspicious, in the row “Field mapping” all fields disappeared and only tags is visible.
    In the legacy mode I can import the file without any problems.

Are you able to provide an export of your collection without media and copies of those files, so we can reproduce the exact environment you’re working with?

Hi Damien,

The files are for you and your team. Please do not share with someone else.

If you need anything else, please let me know.

Best Regards,

Martin

(Attachment 2023-02-02 Control csv file import via header “#keyvalue”.apkg is missing)

(Attachment Import Italienisch Verben.txt is missing)

(Attachment Import Italienisch.txt is missing)

(Attachment Import Italienisch Beispiele.txt is missing)

Attachments won’t work on the forum - please use a file sharing site like Google Drive to create a private sharing link, then send a private message to me&Rumo with the link. Please don’t post it on this thread, or others will be able to access it.

no clue how to do “send a private message to me&Rumo”?

Click our names then “Message”. I’m not 100% sure you have that permission as a new member, though.

You mean here? There is no possibility.

Yeah, then you don’t have that permission, yet. Maybe you could send the files here: Start a discussion - AnkiMobile (iPhone/iPad) Support

just sent

1 Like

Thank you both.

@Rumo a \u{feff} BOM in the first character of the file appears to be the cause of this

1 Like

I’ve made a PR to support your encoding in the future, but for now you can avoid this problem by making sure your text editor saves the file as “UTF-8” instead of “UTF-8-BOM” or similar.

1 Like

Hi Rumo,
thanks for your update.
I’m creating the files with MS Access and with the parameter Charset = “UTF-8”. Because of Damien’s previous statement, I looked already into it, how I can use a different Charset or remove the first character. Nothing found so far.
If you can do a fix in one of you regular updates, I would appreciate it.

Microsoft Office Tools (VBA) are a little bit week in handling of UTF-8, but now I found several proposals in the direction to copy the created file afterwards and to remove the first two digits in VBA. That is working now and for all my input files into the different decks - Separator, HTML, Deck and Notetype - are set as indicated. I’m good with this. Thanks Rumo.
I will see whether I can close the ticket or you can do it.

1 Like

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