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 @ 2023-12-08 08:24  冰底熊  阅读(249)  评论(0编辑  收藏  举报