Question: when is work done by a spring?
Answer: Work is done when a spring is extended or compressed . Elastic potential energy is stored in the spring. Provided inelastic distortion has not happened, the work done is equal to the elastic potential energy stored.