SDKs overview

Numbers is a spreadsheet application developed by Apple Inc., designed for macOS, iOS, and iCloud. Unlike many modern data platforms, Numbers is not an API-first service. Consequently, there are no official Software Development Kits (SDKs) or public APIs provided by Apple for direct programmatic access to Numbers documents or functionalities. The application is primarily intended for direct user interaction through its graphical interface, enabling tasks such as data entry, formula application, chart creation, and document management (Numbers official documentation).

Developers seeking to automate tasks or integrate Numbers with other systems typically rely on platform-specific scripting capabilities rather than traditional SDKs. On macOS, this involves using AppleScript or JavaScript for Automation (JXA) to control the Numbers application interface. For iOS, direct programmatic control similar to an SDK is not available. iCloud-based Numbers documents can be accessed via iCloud Drive, but without a dedicated API for document manipulation, interactions are limited to file-level operations rather than spreadsheet content management.

The absence of an official API means that advanced integrations, such as real-time data synchronization with external databases or automated report generation from non-Apple services, require custom solutions often involving UI automation or manual data export/import processes. This approach contrasts with applications like Microsoft Excel or Google Sheets, which offer extensive APIs for programmatic interaction (Google Sheets API reference).

Official SDKs by language

As Numbers does not offer a public API, there are no official SDKs provided by Apple for any programming language. The interaction with Numbers is primarily through its user interface on Apple devices. For automation on macOS, the primary methods involve scripting languages built into the operating system.

macOS Scripting for Numbers

On macOS, automation of Numbers can be achieved using AppleScript or JavaScript for Automation (JXA). These scripting languages allow developers to send commands directly to applications, simulating user actions or accessing application-specific data models if exposed. Numbers provides a scripting dictionary that defines the commands and objects available for automation.

AppleScript

AppleScript is a scripting language created by Apple Inc. that allows users to directly control scriptable applications and parts of the operating system. Numbers exposes a dictionary of commands that can be used with AppleScript to manipulate spreadsheets, cells, tables, and charts (AppleScript Language Guide).

JavaScript for Automation (JXA)

Introduced in macOS Yosemite, JXA provides a JavaScript interface to the same automation capabilities as AppleScript. It allows developers to write automation scripts using standard JavaScript syntax, interacting with applications through their exposed scripting dictionaries. This can be particularly appealing to web developers already familiar with JavaScript (macOS Automation Scripting Guide).

Installation

Since there are no official SDKs for Numbers, installation does not involve traditional package managers or library imports. Instead, developers utilize the built-in scripting environments of macOS.

AppleScript and JXA on macOS

AppleScript and JXA are native features of macOS. No additional installation is required. Scripts are typically written and executed using the Script Editor application, found in /Applications/Utilities/. Developers can create new scripts, save them as applications, or integrate them into workflows.

Quickstart example

This example demonstrates how to create a new Numbers document, add a table, and insert data using AppleScript on macOS. This approach simulates user interaction through scripting.

AppleScript Example: Create and Populate a Numbers Spreadsheet

To run this example:

  1. Open the Script Editor application (/Applications/Utilities/Script Editor.app).
  2. Copy and paste the AppleScript code below into a new script window.
  3. Click the Run button.

tell application "Numbers"
    activate
    set newDoc to make new document
    tell newDoc
        tell active sheet
            set newTable to make new table with properties {name:"Sales Data", row count:5, column count:3}
            tell newTable
                set value of cell "A1" to "Product"
                set value of cell "B1" to "Quantity"
                set value of cell "C1" to "Price"
                
                set value of cell "A2" to "Widget A"
                set value of cell "B2" to 150
                set value of cell "C2" to 12.99
                
                set value of cell "A3" to "Gadget B"
                set value of cell "B3" to 200
                set value of cell "C3" to 8.50
                
                set value of cell "A4" to "Doodad C"
                set value of cell "B4" to 75
                set value of cell "C4" to 25.00
            end tell
        end tell
    end tell
end tell

This script first activates the Numbers application, then creates a new blank document. Within this document, it accesses the active sheet and creates a new table named "Sales Data" with 5 rows and 3 columns. Finally, it populates the header row and three data rows with example product information. The script demonstrates direct manipulation of Numbers document elements through the application's scripting dictionary.

Community libraries

Given the absence of an official API, there are no widely adopted community-driven SDKs or libraries for Numbers in the traditional sense (e.g., Python, Node.js, Java libraries). Community efforts primarily focus on sharing AppleScript or JXA snippets and utilities for specific automation tasks.

Common Community Contributions and Approaches:

  • AppleScript/JXA Snippet Repositories: Developers often share useful scripts on platforms like GitHub or forums dedicated to Apple automation. These scripts typically address common tasks such as importing CSV data, exporting specific ranges, or generating reports.
  • UI Automation Frameworks: For more complex scenarios where direct scripting access is insufficient, some developers might resort to UI automation frameworks available on macOS (e.g., using accessibility APIs or third-party tools). However, these methods are generally less robust and more prone to breakage with application updates compared to direct API or scripting dictionary interactions.
  • Data Import/Export Utilities: Since Numbers can import and export various formats (CSV, Excel), community tools sometimes focus on preparing data in a compatible format for Numbers or processing data exported from Numbers. This involves working with file formats rather than directly interacting with the Numbers application itself.

It is important for developers to understand that any community solutions relying on UI automation or AppleScript/JXA are dependent on the internal structure and scripting dictionary of the Numbers application. Changes in future versions of Numbers or macOS could potentially break these scripts, requiring maintenance and updates (macOS Automation Scripting Guide).

Official SDKs for Numbers
Language Package/Method Install Command Maturity
AppleScript Built-in macOS scripting N/A (native to macOS) Stable (native OS feature)
JavaScript (JXA) Built-in macOS scripting N/A (native to macOS) Stable (native OS feature)
Python None (no official SDK) N/A Not Applicable
Node.js None (no official SDK) N/A Not Applicable
Java None (no official SDK) N/A Not Applicable