[X] Export playlist to CSV loses track ordering

Dear Supporters,

When I Export my Playlist to a CSV file and open the CSV file in Excel or Notepad++ i notice that the order of the tracks has been lost :frowning: I mean the track in position-1 in the playlist is now appearing somewhere else in Excel.

I have Googled the web for advice and also checked the Help in the application and the Forum but I haven't seen this problem being mentioned anywhere so I guess that I am missing something pretty basic .....

Could some please help me. I am running MP3Tag v.2.78 on Windows 10.

It would be quite nice if I could add an ID counter next to each track in the playlist - at least then in Excel I could sort by this ID.

Kind Regards,
Robbie.

P.S I also speak/read German incase this is better.

Unfortunately, you do not show the export script you use.

The order of the files in the files list gets overwritten by the $loop() statement in your export. The $loop() statement is the command to sort by the string in the ().

There is an extra menu function to create a playlist from the selected files: File>Playlist (selected files).

If you still want to export to a csv file (which is different from a playlist and therefore loosing the order is no bug), then you have to create counter field in the files first and then export the data by looping through the counter field.

You create a counter field with an action of the type "Format value" for a user-defined field, e.g. my_counter
Format string: $num(%_counter%,2)

In the export do not $loop() by e.g. %_filename% but by %my_counter%.

Hi Ohrenkino,

Your advice worked perfectly for me :slight_smile: :rolleyes: ! I created a Custom field under Action as you described and then used this for the ordering in my Export script. I have now managed to export my playlist into Excel and the tracks retain the same ordering as in the playlist which is exactly what I wanted.

I would NEVER have been able to figure this out alone though - so thank you for your help ! it might be an idea to include some information about this in the HELP manual. The software seems very powerful and flexible but I suspect you have to be a professional IT programmer (which I am) to be able to use its features.

Also I wonder whether making a change to the actual files is the best approach for this problem - I would have thought that when you do an export from the Playlist screen it should automatically retain the same "view" from this screen and allow 3rd party tools (like Excel) to do the customising. Alternatively you could include the Export logic but have an override so that if no Export script is specified the default is simply to export exactly as shown in the Playlist.

Below is my Export script,

$filename(csv,utf-16)Id;Filename;Artist;Title;Length;Album;Track;Year;Size;Last Modified;Path;
$loop(%my_counter%)%my_counter%;%title%;%artist%;%album%;%track%;%year%;%_length_seconds%;%_file_size%;%_file_mod_date%;%_folderpath%;%_filename_ext%;
$loopend()
build on %_date% with %_app% - the universal Tag editor - http://www.mp3tag.de/en/

Kind Regards,
Robert.

I just tested something:
It may not be necessary to modify the files as you could just %_counter% as loop variable:

$filename(csv,utf-16)Title;Artist;Album;Track;Year;Length;Size;Last Modified;Path;
$loop(%_counter%)%title%;%artist%;%album%;%track%;%year%;%_length_seconds%;%_file_size%;%_file_mod_date%;%_folderpath%;%_filename_ext%;
$loopend()

Hi Ohrenkino,

I did actually try this before but it doesn't work - it creates a new numbering sequence for the Export csv file but its not the same sequence that I have in my Playlist view so it doesn't help me.

Kind Regards,
Robert.

Actually ignore my last comment - when I tried it I used the counter as a field - but I havent tried it as you have shown as part of the loop counter - so I will try that - although it might be a bit tricky to test now as I have performed the action update already.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.