# Need help w/ Export file

**URL:** https://community.mp3tag.de/t/need-help-w-export-file/15441
**Category:** Support
**Created:** [January 28, 2014, 8:43pm UTC](https://community.mp3tag.de/t/need-help-w-export-file/15441 "2014-01-28T20:43:45Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![laffin\_boy](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/46a35a/32.png) [@laffin\_boy](https://community.mp3tag.de/u/laffin_boy)
#### Post date: [January 28, 2014, 8:43pm UTC](https://community.mp3tag.de/t/need-help-w-export-file/15441/1 "2014-01-28T20:43:45Z")

</div>

Hi,

I'm trying to build a working csv export file and I have two problems:

When I open it in Excel the headers are correct but the first column is missing so all the following columns get shifted one column to the left. here's my file:

```
$filename(csv,utf-16)Track;Title;Directory;Length;Album;Year;
$loop(%_filename_ext%)%track%;%title%;%_directory%;%_length%;%album%;%year%;
$loopend()

```

Secondly how do I get MP3Tag to use the folder name as the exported filename?

TIA

---

<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: [January 28, 2014, 10:04pm UTC](https://community.mp3tag.de/t/need-help-w-export-file/15441/2 "2014-01-28T22:04:31Z")

</div>

> [@laffin\_boy](#):
>
> Hi, I'm trying to build a working csv export file and I have two problems:  
> When I open it in Excel the headers are correct but the first column is missing so all the following columns get shifted one column to the left.

This should not happen, because the column structure is already given by the header line.  
You have to "import" the CSV file into Excel, standard open might not work.

> [@laffin\_boy](#):
>
> ... Secondly how do I get MP3Tag to use the folder name as the exported filename?

Example export script:

**1: $filename($getEnv('USERPROFILE')'\Desktop\Mp3tag.Export.semicolon.'%\_directory%'.csv',UTF-16)'"Track";"Title";"Directory";"Length";"Album";"Year";"Path"'** 

**2: $loop(%\_path%)'"'$num(%TRACK%,1)'";"'%TITLE%'";"'%\_directory%'";"0:0:'%\_length\_seconds%'";"'%ALBUM%'";'%YEAR%'";"'%\_path%'"'  
3: $loopend()**

 

DD.20140129.0005.CET

---

<div class="post-metadata">

### Author: ![chrishirst](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/4af34b/32.png) [@chrishirst](https://community.mp3tag.de/u/chrishirst)
#### Post date: [January 28, 2014, 10:41pm UTC](https://community.mp3tag.de/t/need-help-w-export-file/15441/3 "2014-01-28T22:41:34Z")

</div>

Drop the semicolon at the line ends so the Excel importer sees the EOL (Chr(13)) and 'knows' to start a new line of data.

---

<div class="post-metadata">

### Author: ![laffin\_boy](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/46a35a/32.png) [@laffin\_boy](https://community.mp3tag.de/u/laffin_boy)
#### Post date: [January 29, 2014, 3:51am UTC](https://community.mp3tag.de/t/need-help-w-export-file/15441/4 "2014-01-29T03:51:22Z")

</div>

Thanks for your replies.

> [@Chris Hirst](#):
>
> Drop the semicolon at the line ends so the Excel importer sees the EOL (Chr(13)) and 'knows' to start a new line of data.

I deleted the ";" at the end of the header line in my custom export file and that did the trick. Thanks! But i'm still baffled because the sample csv.mte **has** the ";" at the end of the header line.

```
1: $filename($getEnv('USERPROFILE')'\Desktop\Mp3tag.Export.semicolon.'%_directory%'.csv',UTF-16)

```

Ok I substituted

```
($getEnv('USERPROFILE')'\Desktop\Mp3tag.Export.semicolon.'%_directory%'.csv',UTF-16)for 
(csv,utf-16)but that just resulted in a csv file full of garbage.

```

Let me clarify - what i'm hoping to find is the correct syntax for a variable that will cause MP3Tag to use the MP3 folder name as the name of the csv file.

laffin\_boy

---

<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: [January 29, 2014, 6:05am UTC](https://community.mp3tag.de/t/need-help-w-export-file/15441/5 "2014-01-29T06:05:32Z")

</div>

> [@laffin\_boy](#):
>
> Ok I substituted
> 
> ```
> ($getEnv('USERPROFILE')'\Desktop\Mp3tag.Export.semicolon.'%_directory%'.csv',UTF-16)for 
> (csv,utf-16)but that just resulted in a csv file full of garbage.
> 
> ```
> 
> Let me clarify - what i'm hoping to find is the correct syntax for a variable that will cause MP3Tag to use the MP3 folder name as the name of the csv file.

I am used to output CSV text in ANSI character encoding to Excel.  
I don't know why you want to apply the UTF-16 character encoding.

The Mp3tag placeholder for the folder name of the current file is called "%\_directory%".  
See Mp3tag help manual for further export placeholders.

When the placeholder %\_directory% is applied within the filename part of the export script's $filename function, then %\_directory% contains the foldername of the first file in the given file list.  
This works for me since years.  
Try again.

There is no problem with the trailing semicolon when importing CSV with text lines having a trailing semicolon (with german Excel 2007).

Make sure to **import** the CSV file by the Excel Textconverter Assistent.  
There are additional options for the CSV import, especially about the character encoding and the data format for the columns.

DD.20140129.0805.CET

---

<div class="post-metadata">

### Author: ![laffin\_boy](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/46a35a/32.png) [@laffin\_boy](https://community.mp3tag.de/u/laffin_boy)
#### Post date: [January 30, 2014, 6:33am UTC](https://community.mp3tag.de/t/need-help-w-export-file/15441/6 "2014-01-30T06:33:22Z")

</div>

> [@DetlevD](#):
>
> When the placeholder %\_directory% is applied within the filename part of the export script's $filename function, then %\_directory% contains the folder name of the first file in the given file list.

Ok I tried $filename(%\_directory%,csv,utf-16) at the beginning of the mte script but that did nothing.

Finally the light dawned. I needed to add "%\_directory%" the the "filename" field in the dialog that opens so that you can choose which script to use before you export. Duh! Works fine now.

laffin\_boy

---

<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: [January 30, 2014, 7:28am UTC](https://community.mp3tag.de/t/need-help-w-export-file/15441/7 "2014-01-30T07:28:26Z")

</div>

> [@laffin\_boy](#):
>
> ... I needed to add "%\_directory%" the the "filename" field in the dialog that opens so that you can choose which script to use before you export. Duh! Works fine now.

Yes, I have forgotten to mention. that there is a quirk in the dialog "Export", so that the filename of the export script is not proper updated, when changed manually in the script.  
Moving the selection bar up and down in the picklist should update the dialog field.  
I do this already automatically, without thinking.

DD.20140130.0928.CET

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [January 30, 2014, 8:00am UTC](https://community.mp3tag.de/t/need-help-w-export-file/15441/8 "2014-01-30T08:00:23Z")

</div>

$filename(%\_directory%,csv,utf-16) is wrong syntax

$filename(%\_directory%.csv,utf-16) should work (a dot before csv)

---

<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:24pm UTC](https://community.mp3tag.de/t/need-help-w-export-file/15441/9 "2026-02-09T12:24:53Z")

</div>


