Depending on exactly what you want to do, you can do as David suggested and use graphs. You can change pitch, radius, and direction (2 reverses). I did this one in 2007:
Or, you can wrap the spring easier if the diameter is constant (cylindrical). I did this one in 1999:
Or this as a wrap with closed and ground (flat as you called them) ends. There is a dead coil at each end per spec, tangent contact and nice transitions. It's also extremely robust. I did this one in 2013:
It's all great lessons in advanced geometry. Have fun!