# \[Bug\] File headers not working correctly with .csv files

**URL:** <https://forums.ankiweb.net/t/bug-file-headers-not-working-correctly-with-csv-files/56243>\
**Category:** Help\
**Created:** [February 22, 2025, 10:16pm UTC](https://forums.ankiweb.net/t/bug-file-headers-not-working-correctly-with-csv-files/56243 "2025-02-22T22:16:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anon\_0000](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@Anon\_0000](https://forums.ankiweb.net/u/Anon_0000)\
**Post date:** [February 22, 2025, 10:16pm UTC](https://forums.ankiweb.net/t/bug-file-headers-not-working-correctly-with-csv-files/56243/1 "2025-02-22T22:16:09Z")

</div>

# Steps to reproduce

1. Open LibreOffice Calc and paste the following into it:

```auto
#separator:Comma		
This is a question.	And this is the answer.	Test::CSV
This is a question 2.	And this is the answer 2.	Test::CSV
This is a question 3.	And this is the answer 3.	Test::CSV

```

It will look like this:

 ![anki](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/7/2/7293631ab2125c5d0eecc4c97d0bed4280c06243.png)

1. Safe the file as _test.csv_ and make it comma separated:  
 ![anki](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/e/9/e9fd447a94b7182a9af9492b9cf05f2e5e400939.png)
2. Open Anki.
3. Import test.csv and notice that anki thinks the file is colon separated:  
 ![anki](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/b/5/b5b068795983735f2bd1b1251917a5116a8e8739.png)

# Additional info

The _test.csv_ looks like this:

```auto
#separator:Comma,,
This is a question.,And this is the answer.,Test::CSV
This is a question 2.,And this is the answer 2.,Test::CSV
This is a question 3.,And this is the answer 3.,Test::CSV

```

Removing the trailing commas in the first line (without modifying the tags _Test::CSV_) results in this:

```auto
#separator:Comma
This is a question.,And this is the answer.,Test::CSV
This is a question 2.,And this is the answer 2.,Test::CSV
This is a question 3.,And this is the answer 3.,Test::CSV

```

And:

 ![anki](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/4/e/4ed0b32ae12b2f1383dd05e6a12845b318e54c06.png)  
As you can see Anki now correctly identifies the separator and the field greys out as well.

# Expected Behavior

Anki should be able to handle the .csv file headers correctly. I shouldn’t have to manually alter the first few lines every time I want to import a .csv.

# Actual Behavior

Anki doesn’t correctly apply the file headers, without prior manual modifications.

# Version

```auto
Anki 25.02 (8fc822a6) (src) (ao)
Python 3.9.18 Qt 6.6.2 PyQt 6.6.1
Platform: Linux-6.12.12-amd64-x86_64-with-glibc2.40

===Add-ons (active)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
AnkiWebView Inspector ['31746032', 2023-06-27T21:26, 'None', '']

===IDs of active AnkiWeb add-ons===
31746032

===Add-ons (inactive)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
Image Occlusion Enhanced ['1374772155', 2022-04-09T09:15, 'None', '']
Review Heatmap ['1771074083', 2022-06-30T03:43, 'None', '']
Study Time Stats ['1247171202', 2024-02-24T17:59, 'None', '']

```

---

<div class="post-metadata">

**Author:** ![Anon\_0000](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@Anon\_0000](https://forums.ankiweb.net/u/Anon_0000)\
**Post date:** [March 10, 2025, 8:31pm UTC](https://forums.ankiweb.net/t/bug-file-headers-not-working-correctly-with-csv-files/56243/2 "2025-03-10T20:31:26Z")

</div>

I opened an issue:

> <https://github.com/ankitects/anki/issues/3853>
>
> \> # Steps to reproduce
> \> 1. Open LibreOffice Calc and paste the following into i…t:
> \> \`\`\`
> \> #separator:Comma		
> \> This is a question.	And this is the answer.	Test::CSV
> \> This is a question 2.	And this is the answer 2.	Test::CSV
> \> This is a question 3.	And this is the answer 3.	Test::CSV
> \> \`\`\`
> \> It will look like this:
> \> !\[anki|452x125\](upload://glAcQ3Wqo2NxnOlyx1wOT4xEpfJ.png)
> \> 
> \> 2. Safe the file as \*test.csv\* and make it comma separated:
> \> !\[anki|571x377\](upload://xnXSaAbOHnBpM334uVbrjSVytMB.png)
> \> 3. Open Anki.
> \> 4. Import test.csv and notice that anki thinks the file is colon separated:
> \> !\[anki|484x500\](upload://pVineBdMD5iJL0hXwyu3MHd7OvT.png)
> \> 
> \> # Additional info
> \> 
> \> The \*test.csv\* looks like this:
> \> \`\`\`
> \> #separator:Comma,,
> \> This is a question.,And this is the answer.,Test::CSV
> \> This is a question 2.,And this is the answer 2.,Test::CSV
> \> This is a question 3.,And this is the answer 3.,Test::CSV
> \> \`\`\`
> \> 
> \> Removing the trailing commas in the first line (without modifying the tags \*Test::CSV\*) results in this:
> \> \`\`\`
> \> #separator:Comma
> \> This is a question.,And this is the answer.,Test::CSV
> \> This is a question 2.,And this is the answer 2.,Test::CSV
> \> This is a question 3.,And this is the answer 3.,Test::CSV
> \> \`\`\`
> \> And:
> \> !\[anki|482x500\](upload://bfenz93tAYQWSlpLnaJ0IUeUPpc.png)
> \> As you can see Anki now correctly identifies the separator and the field greys out as well.
> \> 
> \> # Expected Behavior
> \> Anki should be able to handle the .csv file headers correctly. I shouldn't have to manually alter the first few lines every time I want to import a .csv.
> \> 
> \> # Actual Behavior
> \> Anki doesn't correctly apply the file headers, without prior manual modifications.
> \> 
> \> # Version
> \> \`\`\`
> \> Anki 25.02 (8fc822a6) (src) (ao)
> \> Python 3.9.18 Qt 6.6.2 PyQt 6.6.1
> \> Platform: Linux-6.12.12-amd64-x86\_64-with-glibc2.40
> \> 
> \> ===Add-ons (active)===
> \> (add-on provided name \[Add-on folder, installed at, version, is config changed\])
> \> AnkiWebView Inspector \['31746032', 2023-06-27T21:26, 'None', ''\]
> \> 
> \> ===IDs of active AnkiWeb add-ons===
> \> 31746032
> \> 
> \> ===Add-ons (inactive)===
> \> (add-on provided name \[Add-on folder, installed at, version, is config changed\])
> \> Image Occlusion Enhanced \['1374772155', 2022-04-09T09:15, 'None', ''\]
> \> Review Heatmap \['1771074083', 2022-06-30T03:43, 'None', ''\]
> \> Study Time Stats \['1247171202', 2024-02-24T17:59, 'None', ''\]
> \> 
> \> \`\`\`
> 
> 
> Originally reported here: https://forums.ankiweb.net/t/bug-file-headers-not-working-correctly-with-csv-files/56243?u=anon\_0000

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/1X/8f1279ababc5879d54e4838989f606cfe55af8c7.jpeg) [@system](https://forums.ankiweb.net/u/system)\
**Post date:** [April 9, 2025, 8:31pm UTC](https://forums.ankiweb.net/t/bug-file-headers-not-working-correctly-with-csv-files/56243/3 "2025-04-09T20:31:34Z")

</div>

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