How to insert file path or file name in header/footer

How to insert file path or file name in header/footer?

iMac (27-inch, Late 2013), OS X Yosemite (10.10.5)

Posted on Jan 19, 2016 9:53 PM

Reply
5 replies

Jan 20, 2016 12:51 PM in response to Paradorn BAPE

In the Print Setup pane you can click one of the three header boxes or three footer boxes and enter the name or path.


User uploaded file



The will be text, i.e. it won't update automatically if you change the name of the document the way you can do in Excel.


If you don't want to type out the name, you can have AppleScript get it for you and place it on your Mac's system clipboard, so you can just click in the box and command-v to paste.


tell application "Numbers" to tell front document


set the clipboard toname as text

end tell


If you want the whole path you can use this:


tell application "System Events" to tell process "Numbers"

window 1's attribute "AXDocument"'s value

end tell


set thePath to do shell script "x=" & result's quoted form & ¬

";x=${x/#file:\\/\\/};printf ${x//%/\\\\x}"

set the clipboard tothePath


Running these scripts is easy. Just copy-paste into Script Editor (in Applications > Utilities) and with your Numbers document open, just click the 'run' button. If you find you want to keep using them, the can easily be made into an item in your menu.


Testing results here:


User uploaded file


User uploaded file



You could also have a small AppleScript assemble the document and sheet name for pasting, etc.



SG

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How to insert file path or file name in header/footer

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.