objective-cicloudiwork

Read and write specific cells of an iWork Numbers file stored in iCloud


This is the scenario, I have three iWork Numbers files, created with the latest Mavericks version and saved on iCloud:

timesheet_2014.numbers where I am gathering all the working hours invoice_model.numbers the model for my invoice invoice_register.numbers where I am keeping track of all my due and paid invoices

At the end of the month I am taking figures from the timesheet, preparing an invoice manually, and store its reference in the register.

I am doing all this manually and I am trying to automate the whole process. At the moment I do not want to write a full program, but my preferred choice would be to prepare some sort of objective-c script with this behaviour:

  1. read a given table and cell from the timesheet
  2. Load the model, duplicate it and fill relevant cell with given values
  3. Lookup register for the latest progressive invoice number and assign +1 to the current invoice
  4. Save invoice in PDF (google drive or dropbox storage) and store the reference (just invoice number, due date, ecc..) in register

After the introduction, these are the questions:

  1. Has objective-c a set of specific API for dealing with iWork files ?
  2. How can I load Numbers file from the native iCloud storage ?
  3. I know the answer would be NO, nut I am asking the question in case something has changed with iOS 7: the script would be normally launched from a Mac, but is there any chance I can run from an iOS device with an iOS app ? The app would needs to have access to files on iCloud.
  4. Is there a valid alternative to Objective-c ? Preferrably something built-in in Mavericks.

Solution

  • Has objective-c a set of specific API for dealing with iWork files ?

    No. The file format is not documented, and there's no API.

    How can I load Numbers file from the native iCloud storage ?

    If you saved the document to iCloud from Numbers, you can only access it from Numbers. Apps can only access their own files in iCloud. It's not like a folder. If your app didn't put the file in iCloud, your app can't read the file from iCloud.

    If you want to sync the document, you might consider using Dropbox. It presents a more Mac-like folder/file approach, and you would be able to access documents created by other apps.

    I know the answer would be NO, nut I am asking the question in case something has changed with iOS 7: the script would be normally launched from a Mac, but is there any chance I can run from an iOS device with an iOS app ? The app would needs to have access to files on iCloud.

    It's possible to write iOS apps that share iCloud data with a corresponding Mac app. It doesn't really matter though, because you can't access files saved by Numbers in iCloud.

    Is there a valid alternative to Objective-c ? Preferrably something built-in in Mavericks.

    If you're using the previous version of Numbers (Numbers 2.3, part of iWork '09), you might have some luck using Applescript. The current version of Numbers (Numbers 3.0.1) is not scriptable.