Numbers parser in Python to AppleScript

Python has a module called: numbers-parser
It makes it possible to use Python and Numbers.

To install: pip install numbers-parser

So I made a simple example to extract a cell from the Budget template.
The Budget template is saved to numbersParser.numbers to Desktop folder.

(**
* [numbersParser(args)]
*)
set thePath to POSIX path of (path to desktop) & "numbersParser.numbers"
its numbersParser({thePath})
on numbersParser(args)
	tell application "http://localhost:7080/"
		return call xmlrpc {method name:"numbersParser", parameters:args}
	end tell
end numbersParser

This is function used in XMLRPC server (Twisted) (Look at my other example how to use)

    def xmlrpc_numbersParser(self, *args):
        """
        """
        doc = Document(args[0])
        s = doc.sheets['Budget']
        t = s.tables['Summary by Category']
        c = t.cell('A1')
        return (c.value)

As you could see its very easy to understand. The first argument is the Path args[0]
s = get the sheets name
t = get table name
c = get cell ‘A1’
return the value of variable c

In the top of you Python script you include: from numbers_parser import Document
Reference: Numbers parser in Python

Its means if you are looking for a Numbers parser that does not open Numbers to get values maybe this could be your solution.

3 Likes