Help needed for Sweeping a Rectangle profile

Your curve is not a clean spiral I see, so it will be difficult to script it. Otherwise there is a clear relation between a spiral pitch and amount of needed twist.
for more info take a look at this thread: