Script for Excel


A bit new to Applescipts and struggling with this one.

I am trying to change a column in Excel that is showing as ‘scientific notation’, actually a EAN barcode.

Needs to be shown as whole numbers then file saved as ‘windows CVS’ to upload to a website.

Can get some scripts to work like save and close but not the format change.

Tried this and don’t get errors but it does not change data in worksheet -

tell application "Microsoft Excel"
	tell sheet 1
		tell column 11
			set data type of column 1 of active sheet to number
			set NumberFormat of column 11 to whole
		end tell
	end tell
end tell

If anyone can help it would be brilliant…


A couple issues I see…

You’re telling “column 1” to do something inside a “tell column 11,” but one column is not a property of another column… column 11 isn’t going to be able to change things inside column 1.

Then the format you want for displaying whole numbers is just “0”, not “whole.”

I don’t know if your actual values are in Column 1 or Column 11, but if I put a bunch of really long numbers in Column 1 and set the format to Scientific Notation, this works to turn them back into whole numbers:

tell application "Microsoft Excel" to set the number format of column 1 of sheet 1 to "0"