# Exporting a list of albums via .csv

**URL:** <https://community.mp3tag.de/t/exporting-a-list-of-albums-via-csv/49307>\
**Category:** Support\
**Created:** [June 14, 2020, 2:24pm UTC](https://community.mp3tag.de/t/exporting-a-list-of-albums-via-csv/49307 "2020-06-14T14:24:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![codscratcher](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/ee59a6/32.png) [@codscratcher](https://community.mp3tag.de/u/codscratcher)\
**Post date:** [June 14, 2020, 2:24pm UTC](https://community.mp3tag.de/t/exporting-a-list-of-albums-via-csv/49307/1 "2020-06-14T14:24:31Z")

</div>

I have a couple of hundred albums on various HDD's and I would like a script to export a csv file that lists all albums by artists like this:

Artist, Album, Genre, Year

I seem to be very close with this script...

$filename(csv,utf-16)Artist,Album,Genre,Year  
$loop(%\_folder%)%ARTIST%,%ALBUM%,%GENRE%,%YEAR%  
$loopend()

however, instead of a list of albums I seem to get an entry for each track on the album  
so I get multiple entries for the same album!

I know I'm close but I can't work out where I have gone wrong!  
I have tried to search and follow various threads in the forum but don't seem to be able to nail it... Any help appreciated.

---

<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:** [June 14, 2020, 2:35pm UTC](https://community.mp3tag.de/t/exporting-a-list-of-albums-via-csv/49307/2 "2020-06-14T14:35:37Z")

</div>

> [@codscratcher](#):
>
> I know I'm close

There is no variable called %\_folder%  
See the help on exports:  
" `$loop(%fieldname%)` starts a new loop. The loop data is sorted by the fieldname."  
So if you want to sort by ARTIST and then by ALBUM, it would require 2 loops to sort.  
So I would think the export script would look like:  
$loop(%artist%)$loop(%album%,1)%ARTIST%,%ALBUM%,%GENRE%,%YEAR%  
$loopend()$loopend()

---

<div class="post-metadata">

**Author:** ![codscratcher](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/ee59a6/32.png) [@codscratcher](https://community.mp3tag.de/u/codscratcher)\
**Post date:** [June 15, 2020, 5:40pm UTC](https://community.mp3tag.de/t/exporting-a-list-of-albums-via-csv/49307/3 "2020-06-15T17:40:40Z")

</div>

Hi ohrenkino  
Many thanks for the fast reply! YES!! I finally got it to work with your alterations! Happily listing all my albums now.

---

<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:28pm UTC](https://community.mp3tag.de/t/exporting-a-list-of-albums-via-csv/49307/4 "2026-02-09T12:28:39Z")

</div>


