简体   繁体   中英

Extract multiple hyperlinks from a cell of xlsx file using openpyxl

If a cell contains multiple hyperlinks, the approach mentioned in the following link doesn't work: Extracting Hyperlinks From Excel (.xlsx) with Python
Is there any way to extract multiple hyperlinks in a cell preferably using openpyxl library?

具有多个超链接的单元格

If it is done by shapes, I don't know of any other way to have multiple hyperlinks in the same cell, then Openpyxl cannot do. Have to use Xlwings.

import xlwings as xw


wb = xw.Book('foo.xlsx')
ws = wb.sheets('Sheet1')

for shape in ws.api.Shapes:
    print(f'Hyperlink: {shape.Hyperlink.Address}')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM