Hi, I have a spreadsheet with a Line ID, a Begining point X,Y,Z and End Point X,Y,Z and even a distance plus other attributes. How do I create a polyline in python from this data and keep my attributes.
...even has a parameter to write an ID field -- the doc suggests that is what it is for, your expressed purpose of 'joining' your other attributes to the features. After you join, or if you use join fields, at any rate you can 'preserve' the joined output in a newly exported fc. Or, if you want that automated further, it would be easy for you to work out with what sounds like a 3 step process.
I suppose in order to include the Z component as you mentioned, you could use the Make XY Event instead - it isn't immediately apparent but can accommodate Z, check the webhelp link below:
The syntax (Z is the last parameter): MakeXYEventLayer_management (table, in_x_field, in_y_field, out_layer, {spatial_reference}, {in_z_field})
EDIT: I guess I didn't finish my train of thought there ------ so with the Make XY Event Layer (including your Z component), I think you could do the line processing with the Points To Line tool (then use a join process or cursor operation to get your other field vals).
I'll attach a zip file containing a py (python script), a file gdb this script writes output to, and an xlsx which this script reads input from...pretty self-explanatory I think, esp with the notes from the other 'finding the centroid...' post, with the exception that this doesn't write multipoint output or multiple fcs and this has nothing to do with projecting data. All it includes is XYZ input from 2 xlsx sheets plotted into a pre-made fc, FL east state plane proj with Z enabled w/ vertical datum NAVD_1988.
All that needs to be done to execute is to run the script (created w/ 10.0) from whereever it is unzipped - all 3 (xlsx, gdb, and py) must be in same relative location. Once you see how it runs, you can modify your input sheets with your named range and run accordingly...