[Solved] Access Filename in Calc

Discuss the spreadsheet application
Post Reply
User avatar
nickdrums
Posts: 21
Joined: Sun Aug 31, 2008 3:05 pm

[Solved] Access Filename in Calc

Post by nickdrums »

Hi,

I want to display part of the spreadsheet filename in a calc cell, and expected to find a function or "insert field" command to access the filename, but cannot find anything which does this. Does anyone know how to access the filename?

Cheers, Nick.
Last edited by nickdrums on Mon Aug 03, 2009 2:22 pm, edited 1 time in total.
OOo 3.2.0 on Ms Windows Vista
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Access Filename in Calc

Post by Villeroy »

The print header or footer is the "natural" place for this.
CELL("filename") returns the complete system independent URL including the sheet name: 'file:///path/document.ods'#$SheetX
=MID(CELL("filename");2;FIND("'#";CELL("filename"))-2) returns the URL alone.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
nickdrums
Posts: 21
Joined: Sun Aug 31, 2008 3:05 pm

Re: [Solved] Access Filename in Calc

Post by nickdrums »

Perfect - thank you.
OOo 3.2.0 on Ms Windows Vista
Bartlett
Posts: 3
Joined: Sat Sep 09, 2017 1:32 am

Re: [Solved] Access Filename in Calc

Post by Bartlett »

May I ask for additional help. I just want to display the name of the file without the path (for example "birthdays.ods").

Would you know how to do this?

Bob
Apache OpenOffice 4.1.3 on Windows 10
User avatar
Zizi64
Volunteer
Posts: 11359
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: [Solved] Access Filename in Calc

Post by Zizi64 »

By cell functions and regular expressions:
viewtopic.php?f=9&t=65936
viewtopic.php?t=79375&p=364778

by macro (usage of the text functions of the Tools library):
viewtopic.php?f=45&t=10728
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Post Reply