# Importing cannot partially update existing cards

**URL:** <https://forums.ankiweb.net/t/importing-cannot-partially-update-existing-cards/22051>\
**Category:** Syncing & AnkiWeb\
**Created:** [August 4, 2022, 8:00pm UTC](https://forums.ankiweb.net/t/importing-cannot-partially-update-existing-cards/22051 "2022-08-04T20:00:59Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![lilysirius](https://avatars.discourse-cdn.com/v4/letter/l/958977/32.png) [@lilysirius](https://forums.ankiweb.net/u/lilysirius)\
**Post date:** [August 4, 2022, 8:01pm UTC](https://forums.ankiweb.net/t/importing-cannot-partially-update-existing-cards/22051/1 "2022-08-04T20:01:00Z")

</div>

I was able to do it previously but failed with the recently updated Version ⁨2.1.55 on Linux.

Say there are Fields A, B and C on the note. Field A is the index ‘a’ (to eliminate other factors, it’s set to both the sorting and the first column). Field B has content ‘b’ while Field C is empty. Create a text file with ‘a\tc’. Import the text file. Two fields are identified. Let’s allocate ‘a’ to Field A, and ‘c’ to Field C.

What I expect is an updated note with Field A = ‘a’, Field B= ‘b’, and Field C = ‘c’. But the result is instead Field A = ‘a’, Field B empty, and Field C = ‘c’.

Is there a fast way to achieve the goal?

---

<div class="post-metadata">

**Author:** ![BlackBeans](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/blackbeans/32/2283_2.png) [@BlackBeans](https://forums.ankiweb.net/u/BlackBeans)\
**Post date:** [August 4, 2022, 9:04pm UTC](https://forums.ankiweb.net/t/importing-cannot-partially-update-existing-cards/22051/2 "2022-08-04T21:04:04Z")

</div>

I’m not quite sure about that, but I _think_ Anki decides that two notes are duplicates if their sort fields are the same. If you want to update a note based on the field `A`, you should just need to make it the sort field.

---

<div class="post-metadata">

**Author:** ![abdo](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/abdo/32/654_2.png) [@abdo](https://forums.ankiweb.net/u/abdo)\
**Post date:** [August 4, 2022, 9:40pm UTC](https://forums.ankiweb.net/t/importing-cannot-partially-update-existing-cards/22051/3 "2022-08-04T21:40:49Z")

</div>

> [@BlackBeans](#):
>
> but I _think_ Anki decides that two notes are duplicates if their sort fields are the same.

It’s actually based on the first field: [Detect dups on Sort Field instead of 1st field](https://forums.ankiweb.net/t/detect-dups-on-sort-field-instead-of-1st-field/5411)

---

<div class="post-metadata">

**Author:** ![dae](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/dae/32/65_2.png) [@dae](https://forums.ankiweb.net/u/dae)\
**Post date:** [August 5, 2022, 3:40am UTC](https://forums.ankiweb.net/t/importing-cannot-partially-update-existing-cards/22051/4 "2022-08-05T03:40:27Z")

</div>

This is not possible, as there would be no way to distinguish between a deliberately empty field, and one where you wanted to preserve the existing field. If you export a csv file, make the changes you want, and then import it again, it will ensure any unmodified fields are preserved.

---

<div class="post-metadata">

**Author:** ![lilysirius](https://avatars.discourse-cdn.com/v4/letter/l/958977/32.png) [@lilysirius](https://forums.ankiweb.net/u/lilysirius)\
**Post date:** [August 5, 2022, 4:53am UTC](https://forums.ankiweb.net/t/importing-cannot-partially-update-existing-cards/22051/5 "2022-08-05T04:53:19Z")

</div>

It WAS possible in previous versions.

It’s a very important feature to me since I have tens of thousands of notes and more than one hundred fields. Say if I want to update 100 notes where the index fields are obtained from a separate vocabulary list, simply to select these 100 notes in Anki or match them to a whole deck of cards in Python are both troublesome, especially if I need to perform this regularly.

In previous versions, to deliberately leave a field untouched, I simply set the corresponding field to nothing when importing. If I wanted to deliberately update a field to empty, I would map it to a column which is set to empty in the csv file.

---

<div class="post-metadata">

**Author:** ![dae](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/dae/32/65_2.png) [@dae](https://forums.ankiweb.net/u/dae)\
**Post date:** [August 7, 2022, 11:46pm UTC](https://forums.ankiweb.net/t/importing-cannot-partially-update-existing-cards/22051/6 "2022-08-07T23:46:15Z")

</div>

Sorry, I misspoke. The presence/absence of the field in the mapping should be sufficient to distinguish the two cases, and you are right that this used to work.

Please note that 2.1.55 has not even received a beta release yet.

@Rumo the old code handled this by starting from the existing note text in processFields(), so unmapped fields remained unchanged. It looks like we have access to the existing note in update\_with\_note() - could we take a similar approach there?

---

<div class="post-metadata">

**Author:** ![Rumo](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/rumo/32/1505_2.png) [@Rumo](https://forums.ankiweb.net/u/Rumo)\
**Post date:** [August 9, 2022, 9:40am UTC](https://forums.ankiweb.net/t/importing-cannot-partially-update-existing-cards/22051/7 "2022-08-09T09:40:44Z")

</div>

I don’t think so. The distinction between unmapped and empty fields is already lost at this point. I’ll look into it.

---

<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:** [May 1, 2023, 6:11am UTC](https://forums.ankiweb.net/t/importing-cannot-partially-update-existing-cards/22051/8 "2023-05-01T06:11:55Z")

</div>

Closed on May 1, 2023, 6:11am UTC


