Search code examples
numbersapplescriptapplescript-numbers

AppleScript get the Name of the cell


I'm trying to get a script to search a range in a Number's documents for an email address and then tell me what cell that email was in.

tell application "Numbers" to tell document 1 to tell sheet 1 to tell table 1
    set theEmail to "[email protected]"
    set theRange to range "a:a"
    set theCell to the name of cell is equal to theRange
return theCell
end tell

Solution

  • try this

    tell application "Numbers"
        tell document 1 to tell sheet 1 to tell table 1
            set theEmail to "[email protected]"
            set theRange to range "a:a"
            try
                return name of 1st cell of theRange whose value is theEmail
            on error
                return missing value
            end try
        end tell
    end tell