The G-code for turning a spindle on is M3, but that command alone will not work. It needs a non-zero speed parameter. For example:
will turn the spindle on. To turn it off use M5.
As always, stay safe.