How to quickly generate a Microsoft Office Excel spreadsheet of your Windows Media Player music collection
By paul on 16 May 2008
A reader recently contacted me asking how to generate a list of music he had ripped to his Windows Media Player collection. The problem was he was half-way through ripping his huge CD collection and he’d forgotten what he had left to do.
Over on
Microsoft TechNet the scripting guys show a really neat solution that quickly and easily generates a Microsoft Office Excel spreadsheet of your Windows Media Player music collection.
Here’s what you do:
1. Copy the script below (select the text with your cursor and click Ctrl + C).
Set objPlayer = CreateObject("WMPlayer.OCX" )
Set objMediaCollection = objPlayer.MediaCollection
Set colSongList = objMediaCollection.getByAttribute("MediaType", "Audio")
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
Set objWorkbook = objExcel.Workbooks.Add()
Set objWorksheet = objWorkbook.Worksheets(1)
objWorksheet.Cells(1,1) = "Song"
objWorksheet.Cells(1,2) = "Artist"
objWorksheet.Cells(1,3) = "Album"
objWorksheet.Cells(1,4) = "Length"
objWorksheet.Cells(1,5) = "Times Played"
j = 2
For i = 0 to colSongList.Count - 1
Set objSong = colSongList.Item(i)
objWorksheet.Cells(j,1) = objSong.Name
objWorksheet.Cells(j,2) = objSong.getItemInfo("WM/AlbumArtist")
objWorksheet.Cells(j,3) = objSong.getItemInfo("Album")
objWorksheet.Cells(j,4) = objSong.durationString
objWorksheet.Cells(j,5) = objSong.getItemInfo("UserPlayCount")
j = j + 1
Next
Set objRange = objWorksheet.UsedRange
objRange.Columns.AutoFit()
2. Open Notepad and paste the code into the empty Notepad document.
3. Click ‘Save as…’ and change ‘Save as type’ from ‘Text documents’ to ‘All files’.
4. Click in the File name box and name your script with a .vbs extension. Something like music_cataloger.vbs, for example. Click Save.
5. Find the file you’ve just saved and double-click it.

And that’s it! Almost immediately, a Microsoft Office Excel spreadsheet such as the one shown above will open (click to see it bigger), with a list of your tracks which you can sort by song, artist, album, length and even the number of times played.
Neat, huh?