Ortho-planar springs are springs that move in a linear fashion without rotation. They're got all sorts of practical applications.
This .scad (library with ortho_planar_spiral_spring() module) will generate a flat, ortho-planar spiral spring of whatever size and shape you want. It takes a number of options and there's a bunch of examples in the file so it should be pretty easy to figure out.
I recommend inspecting your springs layer by layer in your slicer before printing because it's real easy to make springs that have walls that are too thin for your 3D printer.
I've found PETG works best for this type of spring but nylon and polycarbonate would also probably work. I do not recommend using PLA!