I am trying to build a tool that will generate a feature class and then populate the fields with the correct column name and format based off a Excel file. Has anyone had any luck doing this before? I'm looking for model or code examples if anyone happens to have anything similar. Has anyone seen any tutoria documents online that do this type of request? That could help also.
Thanks in advance!
The script will run but its not generating the data the way I had hoped. It doesn't look like any of the values in column A in the CSV file were added as column just the values for column B. Here is what the attribute table for the new FC looks like after running the tool:
I want the new FC to have columns based on the data in column A.
What do I need to change??
The arguments for AddField are, (in_table, field_name, field_type), in that order. Check syntax section here.
arcpy.AddField_management(fc, row[0], fieldtypes[row[1][:4]])
fc = the input table
row[0] = the field name (the first column in your spreadsheet. E.g. 'geodb_oid')
row[1][:4] = the first four characters of the second column in your spreadsheet (e.g. 'inte')
fieldtypes[row[1][:4]] = the value associated with the key 'inte' (e.g. 'LONG')
Thanks for your help...almost have it now!
TL
I created a small/quick/convenient model for myself.
----
Hmmm. Is this in the right place?