You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Numbers invoice that is dated when it is created.

Hi I have a numbers template for creating an invoice. It is dated and I would like to use a function so that when I select a new invoice it opens with the date on it.


If I use the 'today' function, then the date changes if I open the spreadsheet on a different day. How can I get the date to stay the same as the date that I created the invoice?

MacBook Air

Posted on Jan 18, 2023 8:37 AM

Reply
Question marked as Top-ranking reply

Posted on Jan 18, 2023 10:04 AM

Here is a test script that looks for "Insert Date" in cell Sheet 1::Table 1::A1 and will overwrite it with the date. If you pre-format the cell as Date&Time with the date format you want, it will display it that way. It is checking every 2 seconds.


tell application "Numbers"
	repeat
		try
			tell front document
				if value of cell "A1" of table "Table 1" of sheet "Sheet 1" is "insert date" then
					set value of cell "A1" of table "Table 1" of sheet "Sheet 1" to date string of (current date)
				end if
			end tell
		end try
		delay 2
	end repeat
end tell



Open the Script Editor app. Copy/paste the script to a new document. Hit the Play button. In Numbers, put "insert date" into that cell and it should change within 2 seconds. Hit the Stop button in Script Editor when you're done trying it out.


A script like this can be turned into an application that can be one of the log-in items to load and run when you log in.

2 replies
Question marked as Top-ranking reply

Jan 18, 2023 10:04 AM in response to Badunit

Here is a test script that looks for "Insert Date" in cell Sheet 1::Table 1::A1 and will overwrite it with the date. If you pre-format the cell as Date&Time with the date format you want, it will display it that way. It is checking every 2 seconds.


tell application "Numbers"
	repeat
		try
			tell front document
				if value of cell "A1" of table "Table 1" of sheet "Sheet 1" is "insert date" then
					set value of cell "A1" of table "Table 1" of sheet "Sheet 1" to date string of (current date)
				end if
			end tell
		end try
		delay 2
	end repeat
end tell



Open the Script Editor app. Copy/paste the script to a new document. Hit the Play button. In Numbers, put "insert date" into that cell and it should change within 2 seconds. Hit the Stop button in Script Editor when you're done trying it out.


A script like this can be turned into an application that can be one of the log-in items to load and run when you log in.

Jan 18, 2023 9:50 AM in response to MikePetru

There are no timestamps in Numbers. If you use TODAY, you can Copy then Paste Formula Results to make it stick. You can use Table->Insert Current Date (or the keyboard shortcut for it) to insert a date that will not change. For that second one, you can create a shorter shortcut so it is easier to type (via System Preferences->Keyboard). Or maybe an AppleScript that is constantly running in the background looking for a document to be opened that has a specific word/phrase in a specific cell of a specific table on a specific sheet and it would insert the date into that cell. It is a very simple script and I think could be loaded when you log into your computer so it is always running

Numbers invoice that is dated when it is created.

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.