XLS / CSV issues in a script

Discussion created by negeise on Nov 22, 2010
Latest reply on Dec 1, 2010 by negeise
I'm very new to Python and haven't had any classes yet so I'm feeling my way around so far. Also if I'm in the wrong forum, please let me know.

I have a script that I am trying to build using python that takes a CSV and creates a shapefile, saves it to a specific location then moves the CSV to a backup folder. Sounds easy right?

I'm calling up the table to point tool from the Military Analyst toolbox which works but the issue that I'm running into is the formatting of the CSV. I have a field called ID that I need to be a text field, and is a text field if I open the CSV in Excel, but when I open it in Arc, it's a Double field. The field data looks like this in excel (s001, s002, v1, v2, s003a, s003b) and like this in Arc (1, 2, 1, 2, NULL, NULL).

When I manually open the CSV in Excel and save it out as an XLS file, it looks fine in Arc but I'm trying to do all of this automatically. The analyst puts the CSV in a "drop box" folder then my script grabs it, makes the shapefile and moves the CSV. So I guess I'm thinking I need to know how to either:

A.) fix the formatting issue and use the current CSV file and then figure out how to move it


B.) figure out how to have the script open excel, save the file as an xls do the processing then create a CSV and put it in the backup folder.