pandas 点击 excel 表格数据,跳转到 sheet2

df.loc[1, '地址(断网)'] = '=HYPERLINK("#Sheet2!B2","单元格的名字")' # 超链接写入单元格

问题:打开excel单元格是文本,需要点击公式框,然后才可以变成连接,

解决:用xlwt模块,无问题

        import xlwt
        book = xlwt.Workbook()
        sheet_index = book.add_sheet('index')
        line = 0
        for i in range(9):
            sheet1 = book.add_sheet(str(i))
            sheet1.write(0, 0, str(i))
            link = 'HYPERLINK("#%s!B2";"%s")' % (str(i), str(i))
            sheet_index.write(line, 0, xlwt.Formula(link))
            line += 1
        book.save('simple2.xls')

原文地址:https://www.cnblogs.com/pythonwl/p/14363360.html