Safari bookmarks to CSV or excel

bookmarkssafari

is there a way to import or convert the bookmarks.html generated by safari bookmark export menu into a CSV that can be imported to excel with 2 columns, URL and Description?
The way it works actually is that the HTML file contains only descriptions with a clickable link and whether you import it to excel, you get only one column with the same theme: clickable links.

Best Answer

  • Export bookmarks from Safari into bookmarks.html
  • Open Terminal and run

    sed -n '/<DT><A HREF/s/^.*<DT><A HREF="\(.*\)">\(.*\)<\/A>/\1;"\2"/p' bookmarks.html > bookmarks.csv
    

This will create a ; separated list containing the URL and the name (in "").