Forum Discussion

Daryl West's avatar
Daryl West
Copper Contributor
Oct 15, 2025

VBA Data Import

Looking for VBA code to parse a list. The list is an extract of a music playlist which retains the Line 1 "name of song", skips the second line which is a repeat of Line 1.

Line 3: Retains Artist name

Line 4: Retains Album Name

Line 5: Time of song - Will probably have to manually move or delete these manually

The list is one of my Playlist from Amazon Music Prime. 

 

Thank you.

SongArtistAlbumTime
    
    
    
    
Whisper

Whisper

Marion Meadows

Whisper

4:16

Just Doing Me

Just Doing Me

Marion Meadows

Just Doing Me

2:54

Midnight Bolero

Midnight Bolero

Armik

Amor De Guitarra

4:52

Every Kinda People

Every Kinda People

Architects of Sound

 

2 Replies

  • How about this:

     

    Sub ParseAmazonPlaylist()
        Dim wsSource As Worksheet
        Dim wsOutput As Worksheet
        Dim i As Long, outRow As Long
        Dim songName As String, artistName As String, albumName As String
    
        ' Set source and output worksheets
        Set wsSource = ThisWorkbook.Sheets("Sheet1") ' Change to your source sheet name
        Set wsOutput = ThisWorkbook.Sheets.Add
        wsOutput.Name = "ParsedPlaylist"
    
        ' Set headers
        wsOutput.Cells(1, 1).Value = "Song"
        wsOutput.Cells(1, 2).Value = "Artist"
        wsOutput.Cells(1, 3).Value = "Album"
        outRow = 2
    
        ' Start parsing from row 6 (assuming header + 5 lines per song)
        i = 6
        Do While wsSource.Cells(i, 1).Value <> ""
            songName = wsSource.Cells(i, 1).Value
            artistName = wsSource.Cells(i + 2, 1).Value
            albumName = wsSource.Cells(i + 3, 1).Value
    
            ' Write to output sheet
            wsOutput.Cells(outRow, 1).Value = songName
            wsOutput.Cells(outRow, 2).Value = artistName
            wsOutput.Cells(outRow, 3).Value = albumName
    
            ' Move to next song block
            i = i + 5
            outRow = outRow + 1
        Loop
    
        MsgBox "Playlist parsed successfully!", vbInformation
    End Sub

     

    • Daryl West's avatar
      Daryl West
      Copper Contributor

      Really appreciate the Help!

      Works well enough where I can now import into a database to keep track. Not sure why it skewed the columns though. In Column A under "Song" placed a decimal value. Then brought in the Song in next column, and Artist in next. However, it gives me enough to work with to keep track of the Playlist. Thank you.

Resources