Using Variables with AppleScript Action in Automator
Keystroke means it will send a &quot;C&quot; to the program and not actually press the C key. Try using key code 8 using command down.
Also, you may want to add a line with activate after the &quot;tell Excel&quot; command to ensure the program is the frontmost application.
Finally, use delay 0.5 between commands, so the program has enough time to process the information before firing the next step.
You can get a list of full key codes here:
https://eastmanreference.com/complete-list-of-applescript-key-codes
Other possible issues: make sure the get value of variable is ignoring the preceding action, otherwise sometimes Automator will pass more than one variable ahead. You could also use item 1 of input as string, because sometimes it will get the wrong kind of data.