Extracting Hyperlinks From Excel (.xlsx) with Python

前端 未结 7 1529
闹比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 17:06

    Starting from at least version openpyxl-2.4.0b1 this bug https://bitbucket.org/openpyxl/openpyxl/issue/152/hyperlink-returns-empty-string-instead-of was fixed. Now it's return for cell Hyperlink object:

    hl_obj = ws.row(col).hyperlink  # getting Hyperlink object for Cell
    #hl_obj = ws.cell(row = r, column = c).hyperlink This could be used as well.
    if hl_obj:
        print(hl_obj.display)
        print(hl_obj.target)
        print(hl_obj.tooltip) # you can see it when hovering mouse on hyperlink in Excel
        print(hl_obj) # to see other stuff if you need
    
    0 讨论(0)
提交回复
热议问题