apple script numbers regarding picking up pop up values in form with script
Trying to pickup pop up values from a specific sheet in form to update records ( see code below ). As per Getting error as below : .. what is the mistake ?
- Get Cat options from "Sheet2" column B
tell application "Numbers"
set catPopUpOptions to {}
tell document "Monthly expenses"
tell sheet "Sheet4" -- Replace "Sheet2" with the name of your other sheet
set catPopUpOptions to value of range "B2:B"
end tell
end tell
end tell
-- Show pop-up menu for Cat field
set chosenCategory to choose from list catPopUpOptions with prompt "Choose a category:" default items ""
repeat
set chosenCategory to choose from list catPopUpOptions with prompt "Choose a category:" default items ""
try
if chosenCategory is false then error "User canceled category selection."
end try
end repeat
set userInput to item 1 of chosenCategory
display dialog "Chosen category: " & userInput
error on running this code : error "Numbers got an error: Can’t get range \"B2:B\" of sheet \"Sheet4\" of document \"Monthly expenses\"." number -1728 from range "B2:B" of sheet "Sheet4" of document "Monthly expenses"
iMac 21.5″, macOS 13.4