Solved! Go to Solution.
..... f2 = open("e:/crs/currentgdb/schema.ini","w") f2.write("""[owners.csv] Format=CSVDelimited ColNameHeader=True col1=TTL_TITLE_NO Text Width 20 col2=OWNERS Text Width 120""") f2.close() print "uses schema.ini" arcpy.conversion.TableToTable(csvOwners,ws,"owners")
..... f2 = open("e:/crs/currentgdb/schema.ini","w") f2.write("""[owners.csv] Format=CSVDelimited ColNameHeader=True col1=TTL_TITLE_NO Text Width 20 col2=OWNERS Text Width 120""") f2.close() print "uses schema.ini" arcpy.conversion.TableToTable(csvOwners,ws,"owners")
You have not specified how you are reading in the text file.
Have you had a look at the schema.ini specification? This is a Microsoft standard for defining the schema for reading in text files.
It works really well for loading text files into a geodatabase table because you can rename, set input widths, types to make the simple table to table tool work very well. This avoids a lot of complex coding opening a file and unpicking the components.