# Exporting to excel

**URL:** https://community.mp3tag.de/t/exporting-to-excel/13552
**Category:** Export
**Created:** [June 16, 2012, 12:10am UTC](https://community.mp3tag.de/t/exporting-to-excel/13552 "2012-06-16T00:10:21Z")
**Posts on this page:** 1
**Showing post:** 4

<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: [June 16, 2012, 6:20am UTC](https://community.mp3tag.de/t/exporting-to-excel/13552/4 "2012-06-16T06:20:42Z")

</div>

> [@graqeme](#):
>
> Have attached script ...

Yes, using the system variable %\_counter% there is no need to set up a user defined counter variable.  
Right after a closed loop the system variable %\_max\_counter% provides the maximum count of the last loop.

I would code the report like this ...  
(maybe it would be more safe to replace the semicolon delimiters by the tab character $char(9))

**1: $filename($getEnv('USERPROFILE')'\Desktop\20120616.Test.Graeme.csv',UTF-16)'"ID";"Title";"Artist";"Album Artist";"Com";"Album";"Track";"Year";"Length";"Size";"Composer";"Path";"Filename"'** 

**2: $loop(%\_filename\_ext%)'"'%\_counter%'";"'%TITLE%'";"'%ARTIST%'";"'%ALBUMARTIST%'";"'%COMMENT%'";"'%ALBUM%'";"'%TRACK%'";"'%YEAR%'";"'%\_length\_seconds%'";"'%\_file\_size\_bytes%'";"'%COMPOSER%'";"'%\_folderpath%'";"'%\_filename\_ext%'"'  
3: $loopend()$repeat($char(13)$char(10),$sub(17,%\_max\_counter%))  
4: '"Check";"Total Files";"Size in Bytes";"Total Size";"Total Time";"Total Time in Seconds";"Date"'  
5: '"'%\_max\_counter%'";"'%\_total\_files%'";"'%\_total\_size\_raw%'";"'%\_total\_size%'";"'%\_total\_time%'";"'%\_total\_time\_raw%'";"'%\_datetime%'"'**

 

You have to take into account the known quirk of the Mp3tag Export Scripting Language.  
Each line of code in the report script itself, creates a linefeed in the report output file.  
There is no way known today, how to suppress these unwanted linefeed output.

 

Regarding the example script from above, there are 3 lines to be subtracted implicitely (20-3=17), to get the totals section exactly into line 20 (valid for %\_max\_counter% \<= 17).

 

DD.20120616.1020.CEST

---

_[View the full topic](https://community.mp3tag.de/t/exporting-to-excel/13552)._
