Import of CSV not reading all File Headers in v. 25.07.01

I have four File Headers in the CSV to import, following instructions in File Headers in the Anki Manual.

Importing now ignores the following separators (commas, in my case) with this recent release. At least it seems to. However, only the separator, html, and deck headers were honoured.

The notetype header was not honoured.

However, if I manually go load the CSV into a text editor and delete all the following separators, the import works fine.

The File Headers of my CSV follow.

#separator:Comma,,,,,,,,
#html:true,,,,,,,,
#notetype:Basic (optional reversed card) EO AK,,,,,,,,
#deck:EO All Official Esperanto Words and Roots,,,,,,,,

File Headers of another file, which also shows the same behaviour (i.e. that the Note Type is ignored).

#separator:Comma,,,,
#html:true,,,,
#notetype:Basic (optional reversed card) EO 1000,,,,
#deck:EO 1000 Most Frequently Occuring Words,,,,

The #notetype:... header is a free-form entry one, unlike #separator:... and #html:... which have a restricted set of possible values. In this case, the notetype header’s value is seen as Basic (optional reversed card) EO AK,,,,,,,,

Then why is the deck header being honoured? I’d have expected both of them to be processed ignored following separators.

It shouldn’t be. It’s also freeform, i.e. looking for a deck with the name EO All Official Esperanto Words and Roots,,,,,,,,

Refer to Loosen csv metadata parsing by iamllama · Pull Request #3862 · ankitects/anki · GitHub. The manual should probably be updated with a notice for this, if anyone wants to get on that.

So no chance of removing the separators, if:

  1. they have been declared by e.g. #separator:Comma, and
  2. the separators are the last characters on the line?

Using File Headers is the only way I can see to document what Note Type and Deck to use for a given tab of data in a spreadsheet. Some decks include more than one Note Type and this relatively new feature has been a boon for me to document the relationships between Note Types and data. It thus also ensures that data is presented correctly in a deck.

I use it in conjunction with the Save Note Type settings add-on, so that I can always recreate the deck, its associated Note Types, and its data (Notes). This helps, when I am asked to share or re-share a deck, which I no longer have in my own Anki collection.

Is there another way to link Note Types, Decks, and Notes, apart from an Anki export? Keeping the data in a spreadsheet allows me to update the data quickly, if a word or term needs to be modified, added or deleted. If I were only able to store them in an Anki export, then I’d have to load that export into a dummy profile, make the correction, and then export it again.

It’s going to need some pretty involved changes in the parser code to support this, from what I understand.

And this is only going to make things more confusing, as the way the freeform headers are parsed would now depend on whether there’s a valid #separator:... header or not. To say nothing of whether said header comes before or after, assuming there’s only one

Bummer! Oh well, I thought we had a solution. Looks like there will still be manual editing steps before we can import.
Thanks for your time, @llama

Yeah, I suspected this might happen - having it work automatically for only certain headers will inevitably be confusing.

Instead of the alphanumeric stripping we were talking about in the past, maybe we could change it to a 2-part process? The first step would be to look for ‘#separator:…’ with all trailing alphanumerics stripped out, and fall back on detection otherwise. And then the second step would be to limit any other header lines to the first column, based on that separator. We’d presumably also need to support quoted first columns. WDYT?