I found a way to do this.
Suppose one .xlsx file named " workbookEx.xlsx " with two sheets named " sheet1 " and " sheet2 " and needs a link from one cell ( A1 ) " sheet1 " to another cell ( E5 ) sheet2 '
from openpyxl import load_workbook wb = load_workbook(workbookEx.xlsx) ws = wb.get_sheet_by_name("sheet1") link = "workbookEx.xlsx#sheet2!E5" ws.cell(row=1, column=1).hyperlink = (link)
The secret was "#", Excel does not show you, but it uses "#" for the same file links, I just had to copy the same link to the file created in Excel into the Word document to see the "#",
It is also possible to skip the file name, that is, associate it with the sheet of the active document, just use: _cell.hyperlink = '#sheetName!A1' .
To name the link you just created, simply set the cell value to the desired line: _cell.value = 'Linkname' .
source share