How do I insert a hyperlink to a document in the current folder?

Hello,

I want to insert a hyperlink to a document. I don’t want to use the local path like (C:\Users\Name\etc…).

I want the link to access the file from the same folder as my spreadsheet document.

The reason is because I am editing the documents on a cloud service. When I go to my office, the path to the folder of the cloud service is not the same to the one at home.

Is there a way to do this? I tried searching the internet but with no success.

Thank you.

This is possible in LibreOffice 6.2 (commit e6b18c1d0f377e1295970b94bdf6b90739e13d4d). Putting something like

=HYPERLINK("relative/path/to/file")

I get a proper link working relative to the saved file’s path (or relative to working directory in the case of not-yet-saved document).

For older versions, a workaround is required. To get current file’s path, you may use these three formulas (say, in A1, A2, and A3):

=SUBSTITUTE(CELL("FILENAME"; A1); "'"; "")
=SUBSTITUTE(A1;"/";"*";LEN(A1)-LEN(SUBSTITUTE(A1;"/";"")))
=LEFT(A1;FIND("*";A2))

Alternatively, a single formula may be used instead of two in A2 and A3, dependent upon regular expressions being enabled in formulas (OptionsLibreOffice CalcCalculateGeneral Calculations):

=LEFT(A1;SEARCH("/[^/]+$"; A1))

The resulting string then may be used throughout the spreadsheet to create the full URL in hyperlinks, like

=HYPERLINK(A3 & "relative/path/to/file")

I tried first formula =HYPERLINK(“relative/path/to/file”) in Libre office 6.0.6.2 and I get this message:

““test.txt” is not an absolute URL that can be passed to an external application to open it.”

Note that Mike wrote it will be possible in 6.2 (after correcting from 6.1) not 6.0.6

I tried first formula =HYPERLINK(“relative/path/to/file”) in Libre office 6.0.6.2 and I get this message:

““test.txt” is not an absolute URL that can be passed to an external application to open it.”

Sigh. Is reading that hard? I wrote: “This is possible in LibreOffice 6.1”. It means 6.1, not 6.0, isn’t it?

It doesn’t work in 6.1 either. I get the same message

I stand corrected. And I apologize, because it’s not 6.1, but (to be released in winter) 6.2 where the change was introduced; I tested with my development build. I should have checked explicitly before answering, and not rely on my memory.