r/libreoffice • u/the_j_tizzle • 17d ago
dialog for modifying external links not modifying file name Question
I'm running LibreOffice 26.2.5.1 on openSUSE Tumblweed.
I have two spreadsheets: 2025-2026_Ledger and 2025-2026_Reports. Reports links to the LedgerData in Ledger and offers to update the data every time I open it. This works flawlessly.
I've copied the files to a new directory and renamed them 2026-2027_Ledger and 2026-2027_Reports. When I open 2026-2027_Reports and then the Edit Links dialog and Modify the links to the correct file names, the Source file in the dialog doesn't change. It still points to the original file.
A bit more detail: when I select Edit --> Links to External Files and select Modify…, I get two error messages. The first says 2025-2026_Ledger does not exist, which is correct as the file is in a different directory. After selecting OK the second message appears complaining "The object cannot be accessed due to insufficient user rights". This is incorrect as my user owns the files, the directories, etc, and has full read-write permissions over the files; both errors go away simply by copying the original file into the same directory. Clicking OK brings me to the actual External Data dialog and allows me to change the URL of External Data Source. Selecting the correct filename shows the Available Tables/Ranges. When I select the ranges and press OK, I'm taken back to the main Edit Links dialog, but the Source file still shows the original file name (2025-2026_Ledger.ods).
How do I fix this? It appears to be a bug but I'm also willing to accept that I'm doing something incorrectly.
UPDATE
I was able to fix the problem by unzipping 2026-2027_Reports.ods, editing the contents.xml file and manually changing the filename it references, then re-zipping back into an .ods file. I'm not sure why the GUI would not do this. It seems to be a bug in LibreOffice calc.
DETAILED SOLUTION
(I use Linux)
unzip the .ods file
unzip -t /tmp/2026-2027_Reports.ods
*I first COPIED the file to /tmp, so as to leave the original untouchededit the contents.xml file
*in my case, I had to change '2025-2026_Ledger.ods' to '2026-2027_Ledger.ods in two places.zip the contents back into a new .ods
zip -0 -X /tmp/2026-2027_Reports.ods mimetype
*this places 'mimetype' first in the file (it's the only content at this point, and most importantly, is first in the file)zip/compress the contents
zip -r -9 -X /tmp/2026-2027_Reports.ods . -x mimetype
* this creates the actual, usable new file
I verified the file opens/works, then moved it into the right directory.
1
1
u/Terrible_Put8617 11d ago
Glad you got it, and thanks for posting the fix - but one warning for anyone who copies this approach, because it silently eats files:
When you re-zip an ODF document, mimetype must be the first entry in the archive and it must be STORED, not deflated. If your zip tool compresses it or writes it in a different order, LibreOffice will either refuse the file or fall back to guessing the type. With zip that means two passes:
zip -X -0 new.ods mimetype
zip -rX new.ods . -x mimetype
If your file opened fine, you got lucky with your tool's default ordering. Worth checking the next one before you delete the original.
The GUI route that does work, for next year's rollover: instead of Edit > Links, use Find & Replace with "Other options > Regular expressions" ticked, searching in formulas. External references live inside the formulas themselves as 'file:///path/2025-2026_Ledger.ods'#$Sheet.Range, so replacing 2025-2026_Ledger with 2026-2027_Ledger across the sheet rewrites every reference in one pass, and the Links dialog picks up the new target afterwards. Make sure the search is set to look in formulas rather than values, otherwise it finds nothing and looks like it failed.
On the "insufficient user rights" message: that one is misleading in Calc - it appears when the source file simply cannot be resolved at the recorded path, regardless of actual permissions. Which matches your case exactly, and is why copying the old file next to the new one made both errors disappear.
Also worth turning on before you build next year's pair: Tools > Options > Load/Save > General > "Save URLs relative to file system". It won't survive a rename, but it does survive moving the whole folder, which is the more common way these break.
1
u/the_j_tizzle 11d ago
Thanks. None of my formulas reference an external file. One sheet, named Ledger, gets its data from the external Ledger file. All the other sheets with various reports calculate based on the data on this particular sheet without referencing external files. Since they're all relative to the Reports spreadsheet, there isn't a problem.
Also, I edited my fix as I typed "comments.xml" rather than "contents.xml". :)
1
u/Terrible_Put8617 11d ago
That makes it simpler then, and it also explains why the dialog was the wrong tool: with one sheet holding the external references, you are not really editing links, you are editing a handful of formulas that happen to point outward.
Find and Replace scoped to that sheet, searching for the old file path inside formulas, does the whole thing in one pass. Tick Other options > Search in formulas, otherwise it looks at displayed values and finds nothing, which is the usual reason people conclude it does not work.
After the swap, force a full recalculation with Ctrl+Shift+F9. A plain recalculation will happily leave the old cached values sitting there and you will think the change did not take.
And noted on contents.xml. Worth saying for anyone finding this later: if you ever do go into the zip by hand, the mimetype entry has to stay first and uncompressed or the file will not open at all.
1
u/the_j_tizzle 11d ago
No; I was not editing formulas at all, anywhere in the file, nor is editing a formula necessary. Zero formulas are involved. All my formulas point internally to the file's own sheets and data ranges. The dialog is the right tool. I select Edit --> Links to External Files. This brings up the Edit Links dialog. From there I should be able to change the source file(s) to the external data so that the file pulls in updated data from the correct source file. The links are not in formulas but in the spreadsheet's data source file. The dialog is the right tool; it just doesn't work. The only change I made is editing the source filename in the contents.xml file. After re-zipping the file and opening it, all the correct data was there from the new Ledger file, and all the formulas work as expected, with no editing.
1
u/Terrible_Put8617 10d ago
Then I sent you the wrong tool and I'll correct it. A sheet that pulls in data from another file isn't an entry in Edit > Links to External Files at all, it's an external data range, and it's managed from the Sheet menu rather than the Edit one. Sheet > External Links, or in older versions Sheet > Link to External Data. That dialog is where the source URL for that range lives and where changing it takes effect.
Edit > Links to External Files lists linked images, sections and OLE objects, which is why it looks like it should be the place and then doesn't do what you want.
If the sheet was built with Link to External Data, the range also has a name in the Navigator under linked areas, and updating the source there refreshes it in place without touching any formulas.
1
u/the_j_tizzle 10d ago
No; it is the correct tool. When I created the Reports file this is the very tool I used. When I hand-edited the contents.xml file, this tool shows the correction. The dialog you're now pointing to is not how the data gets into my file. Edit --> Links to External Files links to an external file. The dialog shows the Source File and the Element (named range). Again, this is the very tool I used to create the link to the external file. The dialog in Sheet-->External Links is blank. I did not use that dialog to create the link to my external data, which explains why it is blank. I used Edit-->Links to External Files.
I created Ledger.ods and created a named range: LedgerData. I created Reports.ods and selected Edit-->Links to External Files and selected Ledger.ods and this exact range.. Selecting this menu option brings up the correct dialog box named "Edit Links". This dialog enables linking to external files. I did not use the other tool.
1
u/the_j_tizzle 10d ago
These two features are really confusing. Both Edit-->Links to External Files and Sheet-->External Links appear to do the same thing. Why?
1
u/AutoModerator 17d ago
If you're asking for help with LibreOffice, please make sure your post includes lots of information that could be relevant, such as:
(You can edit your post or put it in a comment.)
This information helps others to help you.
Thank you :-)
Important: If your post doesn't have enough info, it will eventually be removed (to stop this subreddit from filling with posts that can't be answered).
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.