简体   繁体   English

使用 openpyxl 从 xlsx 文件的单元格中提取多个超链接

[英]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如果单元格包含多个超链接,则以下链接中提到的方法不起作用: Extracting Hyperlinks From Excel (.xlsx) with Python
Is there any way to extract multiple hyperlinks in a cell preferably using openpyxl library?有没有办法最好使用 openpyxl 库在一个单元格中提取多个超链接?

具有多个超链接的单元格

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.如果它是通过形状完成的,我不知道在同一个单元格中有多个超链接的任何其他方法,那么 Openpyxl 不能做。 Have to use Xlwings.必须使用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}')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 openpyxl 在 XLSX 文件中逐个单元格地插入和格式化值 - How to insert and format values cell by cell in an XLSX file using openpyxl 无法使用Pandas或openpyxl在任何.xlsx文件的单元格中检测到EUR - Unable to detect EUR in a cell of any .xlsx file, using pandas or openpyxl openpyxl xlsx文件单元格值=无 - openpyxl xlsx file cell value = none 如何使用openpyxl从python中的xlsx文件中读取货币符号? - How to read a currency symbol from an xlsx file in python using openpyxl? 如何使用 openpyxl 从字典创建 Excel 文件扩展名 .xlsx? - How to create an Excel file extension .xlsx from a dictionary using openpyxl? 如何使用openpyxl创建一个新的xlsx文件? - how to create a new xlsx file using openpyxl? 使用 OpenPyXL 将 XLSX 文件保存到指定位置 - Save XLSX file to a specified location using OpenPyXL 在python中使用openpyxl模块编写xlsx文件 - write xlsx file using openpyxl module in python 如何使用openpyxl读取xlsx流文件 - how to read a xlsx stream file using openpyxl 数据丢失,使用熊猫在具有多个工作表的.xlsx文件中更改格式,同时在现有的.xlsx文件中添加新工作表时使用openpyxl - Data missing, format changed in .xlsx file having multiple sheets using pandas, openpyxl while adding new sheet in existing .xlsx file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM