Format a Numbers cell to currency

I am trying to change the format of a Numbers cell from the default ‘Automatic’ to ‘currency’ using AppleScript but the format does not change, it will allow all other types (date/time, text etc) but not currency, is this a bug?

set the format of cell 1 to currency

Running macOS 13.3.1 and Numbers 13.0

What is in cell 1?

If the value of cell 1 is not compatible with currency then it will retain the automatic format.

For example:

	set cel1 to cell 1 of table 1 of sheet 1 of document 1
	set value of cel1 to "the"
	set format of cel1 to currency
	
	format of cel1
	--> automatic

Curiously enough, if you then type a valid number into the cell, it will reformat it as currency.

NB using Numbers v5.1

The value was an accumulated 2 decimal numeric field from a .csv file so thought it should have been correct. It was not until I added ‘as text’ that it worked but thanks for pointing me in the right direction!

set format of cell (ix + 1) of row i2 to currency|
set value of cell (ix + 1) of row i2 to (item ix of catTotals) as text
1 Like