I'm using the module openpyxl for Python and am trying to create a hyperlink that will take me to a different tab in the same Excel workbook. Doing something similar to the following creates the hyperlink; however, when I click on it, it tells me it can't open the file.
from openpyxl import Workbook
wb = Workbook()
first_sheet = wb.create_sheet(title='first')
second_sheet = wb.create_sheet(title='second')
first_sheet['A1'] = "hello"
second_sheet['B2'] = "goodbye"
link_from = first_sheet['A1']
link_to = second_sheet['B2'].value
link_from.hyperlink = link_to
wb.save("C:/somepath/workbook.xlsx")
I'm assuming the issue lies in the value of 'link_to'; however, I don't know what would need changed or what kind of path I would have to write.
I'm using Python 2.7.6 and Excel 2013.
Support for hyperlinks in openpyxl is currently extremely rudimentary and largely limited to reading the links in existing files.