# Export csv script - need help with excluding Various Artists albums

**URL:** https://community.mp3tag.de/t/export-csv-script-need-help-with-excluding-various-artists-albums/15766
**Category:** Export
**Created:** [May 26, 2014, 4:20pm UTC](https://community.mp3tag.de/t/export-csv-script-need-help-with-excluding-various-artists-albums/15766 "2014-05-26T16:20:18Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![sanjaypm](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/b782af/32.png) [@sanjaypm](https://community.mp3tag.de/u/sanjaypm)
#### Post date: [May 26, 2014, 4:20pm UTC](https://community.mp3tag.de/t/export-csv-script-need-help-with-excluding-various-artists-albums/15766/1 "2014-05-26T16:20:18Z")

</div>

Hi, I am really new at this and not a tech savvy guy at all so I've gone through a fair amount of documentation and export scripts to figure this out but feel that I am missing something pretty simple so thought I'd ask for help. Probably something that one of you experts will see in a minute.  
I have my files organized by Artist/Album (c:/My Music/Artist/Album) and have a few compilations that are in a Various folder instead of Artist so that it is in Various/Album. Also, only the Various Artist albums have Various Artists under the field %albumartist% and the other albums have nothing in this field.  
I am trying to generate a csv download that shows the data as follows:  
Artist1

```
      Album1 year
      Album2 year

```

Artist2

```
     Album1 year
      Album2 year

```

and so on.  
But when I use the script below it also includes the albums that are in the Various Artists folder under each artist which I am trying to exclude. So I wrote the if/neql part to exclude those from the Artist list, and wrote a separate if/eql condition to show those albums separately. I figure that I am doing something wrong with this conditional script so any help appreciated. Thanks.

```
$filename(C:\Album List.csv)

$loop(%_folder%) $if($neql(%albumartist%,Various Artists),
$loop(%artist%,1)"%artist%"
$loop(%album%,1),"%album%","%year%"
$loopend()$loopend(),)
$if($eql(%albumartist%,Various Artists),
$loop(%album%,1)"%albumartist%","%album%","%year%"
$loopend(),)$loopend()
Build Date %_date%
```

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [May 26, 2014, 5:39pm UTC](https://community.mp3tag.de/t/export-csv-script-need-help-with-excluding-various-artists-albums/15766/2 "2014-05-26T17:39:19Z")

</div>

> [@sanjaypm](#):
>
> ... I am trying to generate a csv download that shows the data as follows: ...

Before digging deeper into the export script ...  
at the first glance it looks like the script is not designed to create a standard CSV file format.

Maybe you want a script something like this ...

**$filename($getEnv('USERPROFILE')'\Desktop\AlbumList.csv.txt',UTF-8) $loop(%ARTIST%,1)$loop(%ALBUM%,1)'"'$if2(%ALBUMARTIST%,%ARTIST%)'","'%ALBUM%'","'%YEAR%'"' $loopend()$loopend()**

DD.20140526.2207.CEST

---

<div class="post-metadata">

### Author: ![sanjaypm](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/b782af/32.png) [@sanjaypm](https://community.mp3tag.de/u/sanjaypm)
#### Post date: [May 26, 2014, 6:58pm UTC](https://community.mp3tag.de/t/export-csv-script-need-help-with-excluding-various-artists-albums/15766/3 "2014-05-26T18:58:19Z")

</div>

> [@DetlevD](#):
>
> Before digging deeper into the export script ...  
> at the first glance it looks like the script is not designed to create a standard CSV file format.
> 
> Maybe you want a script something like this ...
> 
> **$filename($getEnv('USERPROFILE')'\Desktop\AlbumList.csv.txt',UTF-8) $loop(%ARTIST%,1)$loop(%ALBUM%,1)'"'$if2(%ALBUMARTIST%,%ARTIST%)'","'%ALBUM%'","'%YEAR%'"' $loopend()$loopend()**
> 
> DD.20140526.2207.CEST

Thanks for the suggestion.  
This does give me a list of Artist/Album/Year that I was looking for. However, my original problem remains, which is if I have an Artist who has a song in a compilation album (these songs are tagged with the Artist under %Artist% and 'Various Artists' under %albumartist%) it shows up in this list for every song by a different artist and I'd like to exclude them from this list (and ideally create a separate list of just these albums). See example of report below:

Ahmad Jamal The Awakening 1997  
Ahmad Jamal The Essence Part 1 1995  
Various Artists The House That Trane Built (4 Disc) 2006

So, here, there was a song by Ahmad Jamal in the album The House That Trane Built and that entry appears for every different artist on that album.

Thanks for the help.

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [May 27, 2014, 5:25am UTC](https://community.mp3tag.de/t/export-csv-script-need-help-with-excluding-various-artists-albums/15766/4 "2014-05-27T05:25:38Z")

</div>

> [@sanjaypm](#):
>
> Thanks for the suggestion. This does give me a list of Artist/Album/Year that I was looking for. However, my original problem remains, which is if I have an Artist who has a song in a compilation album (these songs are tagged with the Artist under %Artist% and 'Various Artists' under %albumartist%) it shows up in this list for every song by a different artist and I'd like to exclude them from this list ...

Maybe you want a script something like this ...

**01: $filename($getEnv('USERPROFILE')'\Desktop\AlbumList.csv.txt',UTF-8)** 

**02: $loop($if2(%ALBUMARTIST%,%ARTIST%),1)$loop(%ALBUM%,1)'"'$if2(%ALBUMARTIST%,%ARTIST%)'","'%ALBUM%'","'%YEAR%'"'  
03: $loopend()$loopend()**

 

DD.20140527.0928.CEST

---

<div class="post-metadata">

### Author: ![sanjaypm](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/b782af/32.png) [@sanjaypm](https://community.mp3tag.de/u/sanjaypm)
#### Post date: [May 28, 2014, 6:47pm UTC](https://community.mp3tag.de/t/export-csv-script-need-help-with-excluding-various-artists-albums/15766/5 "2014-05-28T18:47:33Z")

</div>

> [@DetlevD](#):
>
> Maybe you want a script something like this ...
> 
> **01: $filename($getEnv('USERPROFILE')'\Desktop\AlbumList.csv.txt',UTF-8)** 
> 
> **02: $loop($if2(%ALBUMARTIST%,%ARTIST%),1)$loop(%ALBUM%,1)'"'$if2(%ALBUMARTIST%,%ARTIST%)'","'%ALBUM%'","'%YEAR%'"'  
> 03: $loopend()$loopend()**
> 
>  
> 
> DD.20140527.0928.CEST

Great, that does the trick. Thanks a lot! I really appreciate your input.
