How can I attach an animated sprite at runtime?

Hey guys, I would like to attach a animation I made with the sprite sheet, I am unable to figure it out.
Am I doing it correctly or do I have to call an animation?

            SpriteRenderer GOSprite =  newGameObject.AddComponent<SpriteRenderer>();
            GOSprite.sprite = //The animation I want to play;

Not sure what your are trying to do. To do an animated sprite you can use the Animator with animation clip. Look here: Tutorial

For the runtime thing…keep a reference of the animationclip (or use Resources.Load) you want to add at runtime and add it to the animator controller and trigger it. Animator

a sprite is not animated by itself.