# List of tracks for each album (CSV)

**URL:** <https://community.mp3tag.de/t/list-of-tracks-for-each-album-csv/18984>\
**Category:** Support\
**Created:** [May 15, 2017, 10:48pm UTC](https://community.mp3tag.de/t/list-of-tracks-for-each-album-csv/18984 "2017-05-15T22:48:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pabloluih](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/p/bbe5ce/32.png) [@pabloluih](https://community.mp3tag.de/u/pabloluih)\
**Post date:** [May 15, 2017, 10:48pm UTC](https://community.mp3tag.de/t/list-of-tracks-for-each-album-csv/18984/1 "2017-05-15T22:48:42Z")

</div>

Hello, I am not an expert with syntax of CSV, I have been reading about it but I cannot reach my objetive.  
I want to export a CSV with 1 line=1 album=a list of all its tracks. Because of the csv format limitation I do not know how to add all tracks in 1 same line.  
At this time I tried with this, but it print 1 line for each track:

> [@](#):
>
> $filename(csv,utf-8) "artist","album","year","tracks","trackcount"  
> $loop(%album%)$loop(%track%) "%artist%","%album%","%year%","%track%. %title% ( %\_length% )","%\_total%"  
> $loopend()$loopend()

I want to accomplish something like this, noticing that there are 2 different albums with their corresponding metadata in order to export it to another database:

> [@](#):
>
> Title,"Artist","Year","Country","Format","Cover","Barcode","Label","My rating","Youtube","Genres","Styles","Tracks","Track count"  
> **Michael** ,"Michael Jackson","2010","CD","","","","Epic","","0","Pop, Electronic, Funk / Soul","","1. Hold My Hand ( 03:33 )  
> 2. Hollywood Tonight ( 04:31 )  
> 3. Keep Your Head Up ( 04:51 )  
> 4. (I Like) The Way You Love Me ( 04:34 )  
> 5. Monster ( 05:06 )  
> 6. Best of Joy ( 03:03 )  
> 7. Breaking News ( 04:14 )  
> 8. (I Can't Make It) Another Day ( 03:55 )  
> 9. Behind the Mask ( 05:02 )  
> 10. Much Too Soon ( 02:48 )","10"  
> **2300 Jackson Street** ,"The Jackson 5","1989","Vinyl","","","","Epic","","0","","","1. Art of Madness ( 05:07 )  
> 2. Nothin' (That Compares 2 U) ( 05:22 )  
> 3. Maria ( 05:49 )  
> 4. Private Affair ( 04:10 )  
> 5. 2300 Jackson Street ( 05:06 )  
> 6. Harley ( 04:24 )  
> 7. She ( 05:01 )  
> 8. Alright With Me ( 03:25 )  
> 9. Play It Up ( 04:53 )  
> 10. Midnight Rendezvous ( 04:24 )  
> 11. If You'd Only Believe ( 06:14 )","11"

I hope I made myself clear. Thanks in advance.

---

<div class="post-metadata">

**Author:** ![ryerman](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ryerman/32/5285_2.png) [@ryerman](https://community.mp3tag.de/u/ryerman)\
**Post date:** [May 16, 2017, 1:37am UTC](https://community.mp3tag.de/t/list-of-tracks-for-each-album-csv/18984/2 "2017-05-16T01:37:43Z")

</div>

Make use of the $get and $puts functions.  
[Exporting Tag and File Information – Mp3tag Documentation](https://docs.mp3tag.de/export/#export-scripting-functions)

Try this:

```
$filename($getEnv(USERPROFILE)\Desktop\Albums.csv,utf-8)"artist","album","year","tracks","trackcount"
$loop(%album%)
$loop(%track%)
$puts(TRACKS,$get(TRACKS)',' %track%. %title% ( %_length% ))$puts(TRACKCOUNT,$add($get(TRACKCOUNT),1))
$loopend()
"%artist%"','"%album%"','"%year%"','"$trim($get(TRACKS),', ')"','"$get(TRACKCOUNT)"
$puts(TRACKS,)$puts(TRACKCOUNT,0)
$loopend()

```

The result has lots of blank lines but these can be removed with Notepad++ or online with Text Mechanic ([http://textmechanic.com](http://textmechanic.com))

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [May 16, 2017, 3:29am UTC](https://community.mp3tag.de/t/list-of-tracks-for-each-album-csv/18984/3 "2017-05-16T03:29:37Z")

</div>

> [@pabloluih](#):
>
> ...I want to export a CSV with 1 line=1 album=a list of all its tracks.... to export it to another database:

Just a question: does it really make sense to get all track titles and the album into one line?  
CSV works like a table without the lines. where each column has one specific header.  
So if you have further data following the last TITLE then this data will end up in various columns, depending on the number of TITLES. In your example one album had 10, the other one 11 TITLEs.  
So the finishing "trackcount" can then be found once in column 11 and the next time in column 12.

To cut things short: you have a classical 1:n relation where n is a real variable that varies.  
To get a proper database, you would have to design a record (=one line) with all the data that identifies a single TITLE without hicups. This could be the unique combination of ARTIST, ALBUM, TRACK and TITLE.  
Grouping tracks together so that they show up as one album, is a problem of the database front-end.  
The export should create a unique data set.

---

<div class="post-metadata">

**Author:** ![pabloluih](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/p/bbe5ce/32.png) [@pabloluih](https://community.mp3tag.de/u/pabloluih)\
**Post date:** [May 16, 2017, 11:49am UTC](https://community.mp3tag.de/t/list-of-tracks-for-each-album-csv/18984/4 "2017-05-16T11:49:08Z")

</div>

Thank you! Is much more than I could have done! The only problem is that it seems that the database that I am using sets the tracklist as independent lines for each track. But it is not a problem as it is plain text.

> [@ohrenkino](#):
>
> Just a question: does it really make sense to get all track titles and the album into one line?  
> CSV works like a table without the lines. where each column has one specific header.  
> So if you have further data following the last TITLE then this data will end up in various columns, depending on the number of TITLES. In your example one album had 10, the other one 11 TITLEs.  
> So the finishing "trackcount" can then be found once in column 11 and the next time in column 12.
> 
> To cut things short: you have a classical 1:n relation where n is a real variable that varies.  
> To get a proper database, you would have to design a record (=one line) with all the data that identifies a single TITLE without hicups. This could be the unique combination of ARTIST, ALBUM, TRACK and TITLE.  
> Grouping tracks together so that they show up as one album, is a problem of the database front-end.  
> The export should create a unique data set.

I know, that was what I planned at first but when I saw the structure of the database... The app I am using is Memento Database for Android. I wanted to have all media grouped in one single app, but I am facing the problem that with music it only admits the creation of an album catalog, so you can not add tracks 'one by one' to be grouped into album and consequently related to an artist. I do not know how to explain properly, here is what it allows you to do: [http://imgur.com/a/DTxC3](http://imgur.com/a/DTxC3)

So you see that in 'Tracks' it only admits a list of plain text. That's why I needed this request. The solution that provides @ryerman fits perfectly, but it does not separate each track into multiple lines but with a comma.

Thank you all!

---

<div class="post-metadata">

**Author:** ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)\
**Post date:** [February 9, 2026, 12:26pm UTC](https://community.mp3tag.de/t/list-of-tracks-for-each-album-csv/18984/5 "2026-02-09T12:26:49Z")

</div>


