Export tags


I am new to MP3TAG and firstly let me congratulate Florian on a wonderful program!

I have been playing with exporting the tag data so that I can print reports using MS Access. I have it doing basically what I want, but I would like to include the 'Album Artist' field and I can't see that on the list in the help file. %Composer% is also missing.

Also I am not clear on what the %fieldname% tag means or how to use it, but I suspect it solves my problem above. Examples please.

[As a side issue, I am still wrestling with how best to categorise my music collection. If I have an album of Bach music played by an obscure artist, I would rather it appear under 'Bach' in the Sort by Artist option of my player. Most players don't seem to offer a Sort by Composer, or Sort by Album Artist option :frowning: Is there a thread somewhere on this topic?]

As part of getting the data ready to use in a CSV file, I needed to remove all " double quote marks. I realise (now) that I could do that using a RegEx but it would have been simpler if there was a conventional Search & Replace command. (I need to brush up on RegEx!!)


%albumartist% and %composer%

Google 'tagging classical music' for discussions. If you're stuck with a player or software that can only sort by artist, then you may have to put the composer in the artist field. Or possible construct your album titles to include it first. One suggestion:


You don't have to use a regex for something that simple. Mp3tag does such things using 'actions' and 'action groups'. The type of action you want to use is a Replace. You can either create and save an action group consisting of a single Replace action, or else use a 'quick action', which is a single action executed one time.

Thanks for the pointers.

The word %fieldname% in the paragraph Metadata under the topic export in the Mp3tag manual is nothing more than a descriptive mnemonic placeholder, it cannot be used literally, it stands for all the other possible tag-field names, which are pre-defined or created by the user as a user-defined tag-field, ... well, it might be possible to create a tag-field with that name.

Note: Mp3tag is not CSV ready, neither on importing nor on exporting of data.
Mp3tag exports just simple text. The output format will be designed by the user's report definition.
The user is fully responsible to format the data for exchange between applications.

There is no need to remove a double apostroph from the data, when exporting data from Mp3tag, unless the target application cannot understand proper CSV data.
In general an CSV item with included space must be enclosed in a pair of double apostrophes.
How should an included comma to be escaped?
In an item with included double apostroph this character must be doubled, but not removed.
The user of Mp3tag has to make sure that the exported data looks like useful CSV data or any other data format, which will be accepted by the target application.

See also


Thanks DetlevD.

What I did was put double quotes around every string in the export so then it didn't matter if any string contains a comma (or single quote). It just means nothing can contain a double quote, which I can live with.

I got it working nicely.

For anyone that might find it useful here is what my export definition looks like:


[line breaks mangled]


Ok. If you want to keep embedded double apostrophes for some fields, then this CSV export code might help ...

$loop(%_filename_ext%)'"'$replace(%TITLE%,'"','""')'","'$replace(%ARTIST%,'"','""')'","'$replace(%ALBUMARTIST%,'"','""')'","'$replace(%ALBUM%,'"','""')'","'%TRACK%'","'%YEAR%'","'%_length_seconds%'","'%_file_size%'","'%_file_mod_date%'","'%_folderpath%'","'%_filename_ext%'","'%GENRE%'"' $loopend()