Extracting Hyperlinks From Excel (.xlsx) with Python

前端 未结 7 1559
闹比i
闹比i 2020-12-16 16:29

I have been looking at mostly the xlrd and openpyxl libraries for Excel file manipulation. However, xlrd currently does not support formatting_info=True for .xl

7条回答
  •  粉色の甜心
    2020-12-16 16:50

    This is possible with openpyxl:

    import openpyxl
    
    wb = openpyxl.load_workbook('yourfile.xlsm')
    ws = wb['Sheet1']
    # This will fail if there is no hyperlink to target
    print(ws.cell(row=2, column=1).hyperlink.target)
    

提交回复
热议问题