1

I have a .numbers file in following format:

Product Quantity Price
Apple   5        3
Banana  7        2
Orange  3        4

I need to get three variables with new-line separated values, e.g. identical to what I entered in script for testing:

set Products to "Apple
Banana
Orange"

set Quantities to "5
7
3"

set Prices to "3
2
4"

At best loading the file with closed Numbers.app, but selecting a range is also OK.

1

In the process of doing this exercise I understood lists are much better for storing read data. So here is the working code:

tell application "Numbers" to tell the front document to tell the active sheet to tell table 1
    repeat with i from 2 to the count of cells of column "A" -- row 1 is a header
        set theProduct to formatted value of cell i of column "A"
        set theQuamtity to formatted value of cell i of column "B"
        set thePrice to formatted value of cell i of column "C"

        set the end of Products to theProduct
        set the end of Quantities theQuantity
        set the end of Prices to thePrice
    end repeat
end tell
| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .