python如何提取excel表格中的超链接

复制代码
import xlrd

def get_wb(path):
    wb = xlrd.open_workbook(path)
    return wb
def get_wb(path):
    wb = xlrd.open_workbook(path)
    return wb
def get_hyperlink(wb,sheet_name,cell):
    worksheet = wb.sheet_by_name(sheet_name)
    hyperlink = worksheet.hyperlink_map.get(cell)
    cell = worksheet.cell(cell[0],cell[1])
    hyperlink=hyperlink.url_or_path
    name=cell.value
    item={name:hyperlink}
    # print(item)
    return item


if __name__ == '__main__':
    path = "F:\整体.xls"
    sheet_name = "员工资质信息"
    wb = get_wb(path)
    for i in range(1,3833):
        # 获取18列的超链接
        cell=(i,18)
        link = get_hyperlink(wb,sheet_name,cell)
        print(cell,link)
复制代码

 

posted @   冰底熊  阅读(287)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· 写一个简单的SQL生成工具
· AI 智能体引爆开源社区「GitHub 热点速览」
· C#/.NET/.NET Core技术前沿周刊 | 第 29 期(2025年3.1-3.9)
点击右上角即可分享
微信分享提示