How do I create a link to another sheet in Numbers?
Numbers Version 3.5.2 (2118)
MacBook Pro with Retina display, OS X Yosemite (10.10)
Numbers Version 3.5.2 (2118)
MacBook Pro with Retina display, OS X Yosemite (10.10)
@quinn and Ian,
In case you are experimenting ....
You can jump to the specified target cell (in this document or another open document) by selecting a "link" cell in Table 2's column B and running the script. The script could be attached to a keyboard shortcut via an Automator Service.
SG
--
property delim : "|" -- or whatever other delimiter you want to use in the "link" cell
try
set pv to parseCellValue(getTgt(), delim)
set {d, s, t, c} to {pv's item 1, pv's item 2, pv's item 3, pv's item 4}
jumpTo(d, s, t, c)
on error
display dialog "Can't jump. Check address of target." buttons "OK"
end try
to getTgt()
tell application "Numbers"
tell front document's active sheet
tell (first table whose selection range's class is range)
tell selection range to set theTgt to first cell's value
end tell
end tell
end tell
end getTgt
to jumpTo(d, s, t, c)
tell application "Numbers"
tell documentd'ssheets'stablet
set selection range to cellc
end tell
end tell
end jumpTo
to parseCellValue(tt, delim)
set AppleScript'stext item delimiters to delim
set dstc to tt's text items
return dstc
set AppleScript'stext item delimiters to ""
end parseCellValue
An alternate method would be to place a single cell table on each sheet, with each containing a simple code word that is unique within the document.
Example: goto1, goto2, etc.
From anywhere in the document, press command-F, type the codeword for the sheet you want, and you'll immediately be taken to the sheet containing that codeword.
Here, I'm viewing sheet 1-20 (a renamed duplicate of sheet 1). I got here by using Find (as can be seen by my most recent search term in the Find box).
If I now change my Find request to 'goto1' Numbers finds the only occurrence of that string in the document and takes me to the table (and sheet) containing it. Note that the insertion point is stll in the Find box, and the hit is highlighted in the Find Me table on this sheet.
(As all sheets in the document were created as duplictes of this one , and only the Find me table's content was edited, the appearance of both tables is much the same.)
Regards,
Barry
@quinn and Ian,
In case you are experimenting ....
You can jump to the specified target cell (in this document or another open document) by selecting a "link" cell in Table 2's column B and running the script. The script could be attached to a keyboard shortcut via an Automator Service.
SG
--
property delim : "|" -- or whatever other delimiter you want to use in the "link" cell
try
set pv to parseCellValue(getTgt(), delim)
set {d, s, t, c} to {pv's item 1, pv's item 2, pv's item 3, pv's item 4}
jumpTo(d, s, t, c)
on error
display dialog "Can't jump. Check address of target." buttons "OK"
end try
to getTgt()
tell application "Numbers"
tell front document's active sheet
tell (first table whose selection range's class is range)
tell selection range to set theTgt to first cell's value
end tell
end tell
end tell
end getTgt
to jumpTo(d, s, t, c)
tell application "Numbers"
tell documentd'ssheets'stablet
set selection range to cellc
end tell
end tell
end jumpTo
to parseCellValue(tt, delim)
set AppleScript'stext item delimiters to delim
set dstc to tt's text items
return dstc
set AppleScript'stext item delimiters to ""
end parseCellValue
******************************************************************************** ******************************************************************************** ********************
Any beginner books or (websites) you could recommend for beginner that wants to utilize the code you provided needs some help learning how it all works. I'd like to learn a little more about this. The only coding class I've taken was HTML ..about 13 years ago in high school.
Any recommendation is appreciated.
Alex
I don't think I got my desired result. I would like it to act like a link. When I click something I would like it to automatically go to the sheet I assign it to. I have many sheets and want the links to send me there when I click it.
When I click something I would like it to automatically go to the sheet I assign it to. I have many sheets and want the links to send me there when I click it.
Hi Pravine,
You can enter hyperlinks in Numbers to web pages. But you can't link to cells within Numbers. Using AppleScript, it is possible to jump to a specific cell. But that isn't as handy as just clicking a link, which I understand is what you are looking for.
SG
quinn,
I can't find the old scripts either. But something like this works in Numbers 3:
jumpTo(1, 1, 1, "A1")
to jumpTo(d, s, t, c)
tell application "Numbers"
tell document d
tell sheet s
tell table t
set selection range to cellc
end tell
end tell
end tell
end tell
end jumpTo
In the example the first 1 stands for front document, the second for sheet 1, the third for table 1.
Could call the handler with something like:
jumpTo("MyDocumentName", "MySheetName, "MyTableName", "A1")
SG
property delim : "|" -- or whatever other delimiter you want to use in the "link" cell
try
set pv to parseCellValue(getTgt(), delim)
set {d, s, t, c} to {pv's item 1, pv's item 2, pv's item 3, pv's item 4}
jumpTo(d, s, t, c)
on error
display dialog "Can't jump. Check address of target." buttons "OK"
end try
to getTgt()
tell application "Numbers"
tell front document's active sheet
tell (first table whose selection range's class is range)
tell selection range to set theTgt to first cell's value
end tell
end tell
end tell
end getTgt
to jumpTo(d, s, t, c)
tell application "Numbers"
tell documentd'ssheets'stablet
set selection range to cellc
end tell
end tell
end jumpTo
to parseCellValue(tt, delim)
set AppleScript'stext item delimiters to delim
set dstc to tt's text items
return dstc
set AppleScript'stext item delimiters to ""
end parseCellValue
With this code, can you highlight the parts which change depending on the documents, and perhaps I can have a look at it and figure out how to adapt it to mine, thanks.
Not sure what you are asking. Have you tried running the script?
The code is not what changes according to how your document is set up. What changes is the "link" that you would put in the cell:
So if want to link "to" cell A1 in a table named 'Table 1' in a sheet named 'Sheet 1' in a document named 'MyDocument', then this is what you would enter in the link cell (the cell you are linking "from"):
MyDocument.numbers|Sheet 1|Table 1|A1
Then you would click once on the cell where you have entered this "link," run the script, and Numbers will jump to the cell that the link points to.
If you want to have the "link" point to another cell, then revise what you put in the cell.
SG
Your script appears to be exactly what I need for navigating a large spreadsheet with many sheets. Unfortunatly I can't seem to make the script work for me, either in the large spreadsheet or in a small test using the example posted above. The error message comes up, indicating that the script isn't able to parse the cell into a link. I've tried changing to a different delimiter and re compiling with no luck. The Automator workflow "Jump to Sheet" from another thread works fine, so I don't think there is a problem with my system. I'm using OS 10.10.5 and Numbers 3.5.3. I'm hoping you can help me get this working.
Edit after more testing. For some reason the script works for me without the extension on the file name in the link cell. I'm back on track.
Lloyd Riford
Lloyd,
Glad to hear it's working for you. It can be a little tricky because the document, sheet, and table names have to be exactly right. Not sure why it wouldn't work on your machine when you include the .numbers extension.
I tend to use the "Jump to Sheet" Automator Service more because it usually gets me close to where I want to go without much fuss.
SG
Hi Alex,
You could perhaps start with this.
http://macosxautomation.com/applescript/firsttutorial/index.html
A search for "learn AppleScript" will give you thousands of hits.
Of course you don't have to know the ins and outs of AppleScript to make good use of it. There are thousands and thousands of scripts you can find online.
As far as AppleScript specifically related to Numbers I've found https://iworkautomation.com/ to be a great resource. There is also a lot on macscripter.net. And of course in these forums.
SG
Trying to get this to work on OS X Yosemite with Numbers 3.5 and keep getting the error saying "Can't jump. Check address of target." I have tried removing the extension like Lloyd Riford said worked for him but get same result.
Thanks I'll try that In system preferences. The search function could work but it's a bit clunky. Would love for a button macro-esque function like excel though. Shame Numbers doesn't have that feature. Maybe at WWDC...
Hi SG and quinn,
Maybe you were looking for this discussion:
SGIII has posted a method to jump to a sheet using AppleScript on Automator
Regards,
Ian 🙂.
Hi Pravine,
If the sheet is in the same document you can type "=" ant then navigate to that sheet and table and click on the cell you want.
If the sheet is in another document, you can't do that.
quinn
How do I create a link to another sheet in Numbers?