Bug 60647 - FILESAVE: =CELL("filename") not updated
Summary: FILESAVE: =CELL("filename") not updated
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
(earliest affected) release
Hardware: All All
: lowest enhancement
Assignee: Not Assigned
Depends on:
Blocks: Calc-Function
  Show dependency treegraph
Reported: 2013-02-11 10:05 UTC by Mark Rogers
Modified: 2017-07-23 20:10 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Note You need to log in before you can comment on or make changes to this bug.
Description Mark Rogers 2013-02-11 10:05:45 UTC
CELL("filename",..) should return the filename of the spreadsheet.

It does not update when the file is saved.

Steps to reproduce:
1. Create new spreadsheet.
2. Set A1 to =CELL("filename",A1). Cell reads "#$Sheet1
3. Save document.

Actual result:
A1 value does not change.

Expected result:
A1 should change to read 'file:///<filename with full path>'#$Sheet1

As far as I know this has never worked, it certainly didn't in 3.5.x, I just never got around to filing a bug report. Reporting now as my workaround has also broken in 4.0.x (bug #60645).

Tested on Windows and Linux.
Comment 1 Joel Madero 2013-03-21 14:21:07 UTC
well closing the document and then reopening it fixes the problem. I think this is more of an enhancement request than a bug as it's just not setup to "live update" and you are requesting this additional capability. With that being said:

I can confirm that this is a valid enhancement request on:
Version (Build ID: 9a46e5614f5a0e0bdce3c497f81ca529da8fb5c)
Date:   Mon Mar 18 18:59:09 2013 +0100 
Platform: Bodhi Linux 2.2 x64
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 
As I've been able to confirm the enhancement request I am marking as:

New (confirmed)
Lowest - very rare case that someone uses this particular function, plus very easy workaround of just closing document and reopening. Lastly, only impacts user one time (when file saved as new name) otherwise works fine.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 
LibreOffice is powered by a team of volunteers, every bug is confirmed (triaged) by human beings who mostly give their time for free. We invite you to join our triaging by checking out this link:

There are also other ways to get involved including with marketing, UX, documentation, and of course developing -  http://www.libreoffice.org/get-help/mailing-lists/. 

Lastly, good bug reports help tremendously in making the process go smoother, please always provide reproducible steps (even if it seems easy) and attach any and all relevant material
Comment 2 Peter C. S. Scholtens 2014-10-05 12:51:43 UTC
In a comparable commercial product the same variable only gets updated after re-opening the file. In LO however, the variable is also updated in case a new sheet is created.

I assume that the re-evaluation of the cell value, which is triggered by opening a new sheet, could also be applied when saving it as a new file. However this may create a new problem: if this changed value is seen by LO as editing of data, the file will be again in the "edited/changed" state, requiring anothe save action.
Comment 3 Mark Rogers 2014-10-06 09:40:04 UTC
My argument would be that re-evaluation of this value should take place before saving. Ie the sequence for Save-As should be:
1. Obtain new filename from user, check for file collisions etc, open file handle for writing
2. Change name internally
3. Update any fields that need updating (document properties, =CELL("filename"), etc)
4. Write to disk with new filename

In doing so the refresh of the =CELL value is done immediately before the save and would not therefore trigger a changed state, and furthermore if the document is closed without further changes and re-opened in future then the stored value is correct without further work (although it should be refreshed in case the document has been renamed at the operating system level).

Of-course I have no idea how non-trivial that would be to code.

An alternative, which again might not be possible, would be that what is effectively just a cached value gets cleared/marked stale rather than updated, forcing a refresh when next used.

However, it does seem wrong that in effect I have a saved document that within it's saved content is a stored value that is always wrong unless a re-Save has occurred (rather than a Save-As or first Save from new).
Comment 4 Gordon 2015-02-05 16:11:41 UTC
Regarding =cell("filename")
I test this result against the known name of the file before updates by the user are saved to remind the user that they are using the 'master' copy of the file (an ordering form in calc) and that they should save it with a new name to save the 'ordering' information. 
It does not refresh, so I am not able to determine if a save has been done.
There may be a better way to handle this, but have not found it yet. Will keep digging.
Comment 5 Jean-Baptiste Faure 2015-02-24 05:57:07 UTC
You can use CTRL+MAJ+F9 to force the recalculation. That updates the value in the cell with the correct filename.

Best regard. JBF
Comment 6 Murz 2015-03-18 12:33:17 UTC
Confirm this problem on fresh version and vote for fixing this bug.
Comment 7 Peter Lange 2015-03-18 13:06:56 UTC
Per the request of Murz, I can confirm that the bug is still present in
Also I have noted that even a "Recalculate" will not update the field(but creating a new tab WILL!).
Comment 8 Joel Madero 2015-03-18 14:07:00 UTC
@Murk - there is no such thing as voting inside of LibreOffice. Read this blog for details about how things work: