Is there a way to convert an array of world space points into a "vector animation curve" ?

Currently i am trying to automatically create a animation path from a set of XYZ locations specified in the viewport.
Is there a good way to convert a vector array with these points into a line? I dont need any smooth beziers, just a point to point curve that goes from 0 to 1,2, 3, 4 etc all the way to the last entry number, that i can put in a timeline.