Automates Apple Numbers via JXA with AppleScript dictionary discovery. Use when asked to "automate Numbers spreadsheets", "create spreadsheets programmatically", "JXA Numbers scripting", or "bulk data operations in Numbers". Focuses on sheets, tables, ranges, batch I/O, clipboard shim, and high-performance data workflows.
Installation
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Automates Apple Numbers via JXA with AppleScript dictionary discovery. Use when asked to "automate Numbers spreadsheets", "create spreadsheets programmatically", "JXA Numbers scripting", or "bulk data operations in Numbers". Focuses on sheets, tables, ranges, batch I/O, clipboard shim, and high-performance data workflows.
import PyXA
numbers = PyXA.Numbers()
# Get first document, sheet, and table
doc = numbers.documents()[0]
sheet = doc.sheets()[0]
table = sheet.tables()[0]
# Read all rows with data
rows = table.rows()
data = []
for row in rows:
cells = row.cells()
if cells: # Skip empty rows
row_data = [cell.value() for cell in cells]
data.append(row_data)
print("Table data:", data)
PyObjC with Scripting Bridge:
from ScriptingBridge import SBApplication
numbers = SBApplication.applicationWithBundleIdentifier_("com.apple.Numbers")
# Access document and table
doc = numbers.documents()[0]
sheet = doc.sheets()[0]
table = sheet.tables()[0]
# Read table data
rows = table.rows()
data = []
for row in rows:
cells = row.cells()
if cells:
row_data = [cell.value() for cell in cells]
data.append(row_data)
print("Table data:", data)
Batch write with clipboard shim (JXA - Legacy):
const numbers = Application('Numbers');
// Prepare data arrayconst data = [['Name', 'Age'], ['Alice', 25], ['Bob', 30]];
// Use clipboard for bulk insertionconst app = Application.currentApplication();
app.includeStandardAdditions = true;
app.setTheClipboardTo(data.map(row => row.join('\t')).join('\n'));
numbers.activate();
delay(0.5);
// UI scripting to pasteSystemEvents = Application('System Events');
SystemEvents.keystroke('v', {using: 'command down'});
Batch write (PyXA - Modern):
import PyXA
numbers = PyXA.Numbers()
# Prepare data
data = [
['Name', 'Age'],
['Alice', 25],
['Bob', 30]
]
# Get table to write to
doc = numbers.documents()[0]
sheet = doc.sheets()[0]
table = sheet.tables()[0]
# Clear existing data and write new data
table.clear() # Clear table firstfor i, row_data inenumerate(data):
# Add row if neededif i >= len(table.rows()):
table.rows().push({})
# Set cell values
row = table.rows()[i]
for j, value inenumerate(row_data):
if j >= len(row.cells()):
row.cells().push({})
cell = row.cells()[j]
cell.value = value
PyObjC Batch Write:
from ScriptingBridge import SBApplication
numbers = SBApplication.applicationWithBundleIdentifier_("com.apple.Numbers")
# Prepare data
data = [
['Name', 'Age'],
['Alice', 25],
['Bob', 30]
]
# Get table
doc = numbers.documents()[0]
sheet = doc.sheets()[0]
table = sheet.tables()[0]
# Clear and write data
table.clear()
for i, row_data inenumerate(data):
# Ensure row existswhilelen(table.rows()) <= i:
table.rows().push({})
row = table.rows()[i]
for j, value inenumerate(row_data):
# Ensure cell existswhilelen(row.cells()) <= j:
row.cells().push({})
cell = row.cells()[j]
cell.value = value
When Not to Use
General macOS automation without Numbers involvement
AppleScript alone suffices (no JXA logic needed)
Complex UI interactions beyond data operations (use automating-mac-apps)