Goal: To have a hyperlink in an xlsx that can open a local pdf file via a relative path.
I can use the module to do it via an absolute path generated by os.getcwd()... but I need to take the xlsx, move it to a new directory (along with the pdfs) and not break the links encoded in the xlsx with write_url(). I cannot run the code in the destination directory (which would make this problem disappear), I have to run it on a local machine to produce the xlsx with all it's links, then move it to the new dir so that other users can see and use the links (to the pdfs which will all be moved along with the xlsx).
Unknown:
How "NETWORK" mentioned in the external file url section of the docs works. It is really talking about another xlsx file, not a different type of file, so maybe it won't work at all.
(docs link: https://xlsxwriter.readthedocs.io/worksheet.html?highlight=write_url#worksheet-write-url )
Excerpt:
Links to network files are also supported. Network files normally begin with two back slashes as >follows \NETWORK\etc. In order to generate this in a single or double quoted string you will >have to escape the backslashes, '\\NETWORK\etc' or use a raw string r'\NETWORK\etc'. Alternatively, you can avoid most of these quoting problems by using forward slashes. These are >translated internally to backslashes:
worksheet.write_url('A14', "external:c:/temp/foo.xlsx")
worksheet.write_url('A15', 'external://NETWORK/share/foo.xlsx')
write_url(row, col, url[, cell_format[, string[, tip]]])
Write a hyperlink to a worksheet cell.
Parameters: row (int) – The cell row (zero indexed). col (int) – The cell column (zero indexed). url (string) – Hyperlink url. cell_format (Format) – Optional Format object. Defaults to the Excel hyperlink style. string (string) – An optional display string for the hyperlink. tip (string) – An optional tooltip.