Sketch a centerline the same height as the spring.
Sketch a rectangle of the wire size with the top line of the rectangle level with the bottom of the centerline. Dimension the edge of the rectangular wire profile the right distance away from the cline so that the diameter comes out as you want it. Finish the sketch.
Invoke Coil. I used the Pitch and Height option to create the spring. Take the height one turn above your required length.
Start a sketch on a plane that bisects the spring vertically and draw a rectangle top and bottom that you can use to trim the spring ends.