Sunday, October 14, 2012

Transpose a table with iWork '09 Numbers

I don't use spreadsheet too often, but sometimes I happen to use iWork '09 Numbers. The most annoying thing about it is the lack of a very basic feature: the possibility to traspose the content of a worksheet. It is a shame that such a functionality does not come built in and that to have it I had to end up writing an AppleScript.

Please note that the script I wrote is far from being complete and bulletproof, but I can't stand AppleScript so I stopped coding as soon as I had something to get my work done.
The script works only if you want to transpose the whole first table contained in the first sheet.

If you want to have that code readily available from Numbers you should activate apple script menu bar from AppleScript Editor preferences. Then open numbers, click on the AppleScript menu icon and the Open Numbers Scripts folder.

Copy the script into that folder, restart numbers and you will find the script under the AppleScript menu icon.

I'm not satisfied at all with that solution, but this time I sticked to the done is better than perfect philosophy saving time for doing something more fun.


Cravery Lamperouge said...


Anonymous said...

Thanks very much :)

nea said...

Thanks. This was super helpful.

nea said...

very helpful. Thanks

Ward said...

This script worked the first time ... except empty cells from the original table were filled with zeros in the new table.

I added a new line after "set original_value to the value of cell i of row j":

if original_value = 0 then set original_value to ""

I realize this will discard any actual zero values, but that's fine for the my current needs.

I also corrected the spelling of "orignal_table".

Betsalel Williamson said...

I seem to get an error number -10000 when I try to copy and set date values, i added a try block so it copies the rest of the info, but any way to copy the correct date values?

Fabien Rosso said...

Thank you so much