With Excel for MAC, consider a VBA solution as VBA is the most common language to interface to the Excel object library. Below downloads the iShares xml then saves it as csv for pandas import using OpenXML and SaveAs methods.
Note: this is untested on Mac but hopefully the Microsoft.XMLHTTP object is available.
VBA (save in a macro-enabled workbook)
Option Explicit
Sub DownloadXML()
On Error GoTo ErrHandle
Dim wb As Workbook
Dim xmlDoc As Object
Dim xmlfile As String, csvfile As String
xmlfile = ActiveWorkbook.Path & "\file.xml"
csvfile = ActiveWorkbook.Path & "\file.csv"
Call DownloadFile("https://www.ishares.com/us/258100/fund-download.dl", xmlfile)
Set wb = Excel.Workbooks.OpenXML(xmlfile)
wb.SaveAs csvfile, 6
wb.Close True
ExitHandle:
Set wb = Nothing
Set xmlDoc = Nothing
Exit Sub
ErrHandle:
MsgBox Err.Number & " - " & Err.Description, vbCritical
Resume ExitHandle
End Sub
Function DownloadFile(url As String, filePath As String)
Dim WinHttpReq As Object, oStream As Object
Set WinHttpReq = CreateObject("Microsoft.XMLHTTP")
WinHttpReq.Open "GET", url, False
WinHttpReq.send
If WinHttpReq.Status = 200 Then
Set oStream = CreateObject("ADODB.Stream")
oStream.Open
oStream.Type = 1
oStream.Write WinHttpReq.responseBody
oStream.SaveToFile filePath, 2 ' 1 = no overwrite, 2 = overwrite
oStream.Close
End If
Set WinHttpReq = Nothing
Set oStream = Nothing
End Function
Python
import pandas as pd
csvfile = "/path/to/file.csv"
# IMPORT CSV INTO PANDAS DATAFRAME
df = pd.read_csv(csvfile, skiprows=8)
print(df.describe())
# Weight (%) Price Coupon (%) YTM (%) Yield to Worst (%) Duration
# count 625.000000 625.000000 625.000000 625.000000 625.000000 625.000000
# mean 0.159888 101.298768 6.500256 5.881168 5.313760 2.128688
# std 0.126833 10.469460 1.932744 4.059226 4.224268 1.283360
# min -0.110000 0.000000 0.000000 0.000000 -8.030000 0.000000
# 25% 0.090000 100.380000 5.130000 3.430000 3.070000 0.970000
# 50% 0.130000 102.940000 6.380000 4.930000 3.910000 2.240000
# 75% 0.190000 105.000000 7.630000 6.820000 6.070000 3.260000
# max 1.750000 128.750000 12.500000 40.900000 40.900000 5.060000