Excel Developer Tip


Return to The Spreadsheet Page

Excel page

Tip archives

Creating A List of MP3 Files

Here's an Excel application that generates a list of MP3 files, and displays them in a handy pivot table report.

The file uses VBA macros, so you must enable macros when you open the file. The VBA code is not protected.

To use it, click the 'Select MP3 Directory' button on Sheet1. You will be prompted for a directory that contains MP3 files. The report will use that directory, plus all of its subdirectories. Sheet1 will contain a list of files, with the following columns:

  • Path
  • Filename
  • Size
  • Date/Time
  • Artist
  • Album Title
  • Year
  • Track No.
  • Genre
  • Duration
  • Bit Rate

This information is then fed into a pivot table like the one shown below:

The songs are arranged by genre, artist, and album. For each album, it displays the number of songs, the total duration, and the total file size. If you're a stickler for detail, this application will also help you identify MP3 files with missing or incorrect tags.

This requires a reference to: Microsoft Shell Controls and Automation (shell32.dll). If it doesn't work for you, check the reference using Tools - References in the VB Editor

The technique I used to get the MP3 file information is based on this MS Technet article: Retrieving Extended File Properties

Note: Generating the report can be very slow. Keep your eye on the status bar for a progress report.