# Import tags from csv

**URL:** <https://discourse.beets.io/t/import-tags-from-csv/1618>\
**Category:** Help\
**Created:** [December 22, 2020, 1:05pm UTC](https://discourse.beets.io/t/import-tags-from-csv/1618 "2020-12-22T13:05:37Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![johan](https://avatars.discourse-cdn.com/v4/letter/j/dec6dc/32.png) [@johan](https://discourse.beets.io/u/johan)\
**Post date:** [December 22, 2020, 1:05pm UTC](https://discourse.beets.io/t/import-tags-from-csv/1618/1 "2020-12-22T13:05:37Z")

</div>

Hi,

i was wondering if there is a feature with which i can import tags (for existing items) from a flat file. I collect music which is not always available on discogs/musicbrainz. Plus sometimes the importer doesnt copy the right track info when importing so an easy workflow to correct these things “by hand” would help me out immensely.

Thanks in advance for your help,  
Johan

---

<div class="post-metadata">

**Author:** ![adrian](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/adrian/32/4_2.png) [@adrian](https://discourse.beets.io/u/adrian)\
**Post date:** [December 22, 2020, 1:25pm UTC](https://discourse.beets.io/t/import-tags-from-csv/1618/2 "2020-12-22T13:25:38Z")

</div>

Interesting idea! I personally can’t think of anything in beets that would let you do that exactly. The closest thing might be the `edit` plugin, which lets you modify the metadata for your music as a YAML document. You might also be interested in trying to craft your own plugin for this use case, if that’s feasible.

---

<div class="post-metadata">

**Author:** ![johan](https://avatars.discourse-cdn.com/v4/letter/j/dec6dc/32.png) [@johan](https://discourse.beets.io/u/johan)\
**Post date:** [December 23, 2020, 9:19am UTC](https://discourse.beets.io/t/import-tags-from-csv/1618/3 "2020-12-23T09:19:52Z")

</div>

thanks for your quick reply. i am currently reading through the source code, to understand how it works. i would love to build a plugin for this, but i still need to learn a couple of things before i’d be able to do so.

this might be a bit of a noob question, but do you have any advice which tool/method I can use to debug (more specifically step through the code) with specific commands?

in other words, I want to see what functions get triggered in what order if I type in a command like “beet edit artist=Perko”.

the edit command doesnt work for me atm, and more generally i would like to learn how i can look at the inner workings of beets in action.

---

<div class="post-metadata">

**Author:** ![adrian](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/adrian/32/4_2.png) [@adrian](https://discourse.beets.io/u/adrian)\
**Post date:** [December 23, 2020, 2:13pm UTC](https://discourse.beets.io/t/import-tags-from-csv/1618/4 "2020-12-23T14:13:31Z")

</div>

I think my best suggestion would be to use pdb:

> **[pdb — The Python Debugger — Python 3.9.1 documentation](https://docs.python.org/3/library/pdb.html)**

It’s not exactly easy to use, but it’s super powerful and therefore probably worth learning if you’re interested in exploring. You can insert a `set_trace` call inside the edit plugin and see the stacktrace there, step through the code one line at a time, etc.

---

<div class="post-metadata">

**Author:** ![johan](https://avatars.discourse-cdn.com/v4/letter/j/dec6dc/32.png) [@johan](https://discourse.beets.io/u/johan)\
**Post date:** [December 27, 2020, 10:45pm UTC](https://discourse.beets.io/t/import-tags-from-csv/1618/5 "2020-12-27T22:45:43Z")

</div>

Thank you very much! I have started to look into it. might take me a bit to fully understand it.

---

<div class="post-metadata">

**Author:** ![halloleo](https://avatars.discourse-cdn.com/v4/letter/h/ccd318/32.png) [@halloleo](https://discourse.beets.io/u/halloleo)\
**Post date:** [December 28, 2020, 12:59am UTC](https://discourse.beets.io/t/import-tags-from-csv/1618/6 "2020-12-28T00:59:05Z")

</div>

> [@johan](#):
>
> i was wondering if there is a feature with which i can import tags (for existing items) from a flat file.

This would be a cool feature! I have started to use beets for cataloging audio files and it would help a lot if I could create some preset file (CSV or else) which says:

_Files matching this regex/string pattern in the file name should get these fields._

And then on import applies this automatically.

---

<div class="post-metadata">

**Author:** ![johan](https://avatars.discourse-cdn.com/v4/letter/j/dec6dc/32.png) [@johan](https://discourse.beets.io/u/johan)\
**Post date:** [December 29, 2020, 10:08am UTC](https://discourse.beets.io/t/import-tags-from-csv/1618/7 "2020-12-29T10:08:55Z")

</div>

I found out the other day that mp3tag now has a beta mac version. So I’m using this now for my needs until I more fully understand the beets code.

---

<div class="post-metadata">

**Author:** ![Awfki](https://avatars.discourse-cdn.com/v4/letter/a/74df32/32.png) [@Awfki](https://discourse.beets.io/u/Awfki)\
**Post date:** [December 29, 2020, 3:02pm UTC](https://discourse.beets.io/t/import-tags-from-csv/1618/8 "2020-12-29T15:02:08Z")

</div>

I did this with a bash script. It reads lines from beet\_batch.txt and evals them with “beet mod -y”. I echo’d it to another file so I could see what it did and fix those cases where the artist+title matched more than one song.
