AnsweredAssumed Answered

TextToColumns in Excel with win32com and arcpy

Question asked by kmjohnson_1 on Dec 9, 2014
Latest reply on Dec 9, 2014 by kmjohnson_1

I have searched extensively but can't really find any good documentation on using the TextToColumns method within Excel using win32com. The VB developer help gives the following example, but translating the parameters into Python has been a challenge.



Selection.TextToColumns DataType:=xlDelimited, _
  ConsecutiveDelimiter:=True, Space:=True



The code I currently have takes 2 fields in a shapefile and concatenates them together with a "_" for unique identifier summarizing purposes while in ArcGIS, i.e.,


exRock = "!ROCKTYPE1!+'_'+!ROCKTYPE2!"


Once the tables are exported to DBF and then converted to an XLS file, I want to separate the fields again based on the "_".


If there is an easier way to do this without Excel any insights would be appreciated! I have tried using the .partition() method and csv files/strings however I can't get that to work correctly either.