AppleScript: Add Commas to Numbers Without String Conversion
Can AppleScript format number values in an Apple Numbers sheet without conversion to a string?
I am using AppleScript to import a financial report into Apple Numbers, with a lot of reformatting. I can set the data format of my numeric data to "Number" (as I would in the Cell tab of the Format Inspector), but I can't:
- add a 'thousands separator', the commas used in the US to delimit thousands in a number; or
- set the number of decimal places to a fixed number (2 is conventional).
So, I get a number like 1234.5, instead of 1,234.50, which is what I need.
I know I can set these formats manually after the script runs, but it's going to be easier if I can script the process. And I know I can convert the values to strings and reformat that way, but I need numeric values, not strings.
So, here's my question: Does AppleScript offer any way to perform this formatting directly, or will I have to script the UI to do it? Any code snippets would be really helpful. Thanks!
iMac, 27" Late 2013