So, I successfully converted my .csv to a .dbf with this script:
env.workspace = r"c:\Output"
inTable = r"c:\Output\test.csv"
outLocation = r"c:\Output"
outTable = "test.dbf"
arcpy.TableToTable_conversion(inTable, outLocation, outTable)
The problem is, in the resulting .dbf file, its adding a decimal with trailing zeroes to the value:
750050
becomes
750050.00000000000
How can I avoid this?
Solved! Go to Solution.
Did you mean to format date with three Ms?
I just grabbed that directly from the example. I thought about just removing it altogether and let it carry over the date as is, but figured I'd leave it in just in case.
It should work - according to the documentation "All Microsoft Jet formats except A.M. and P.M. are supported."
Also, did you rename your columns to A,B,C,D, etc?
your column names are A,B, etc?
another visual
Using the Schema.ini File to Import a CSV File into ArcGIS | GISNuts.com
and make sure there no blank rows...especially at the end of the file
Well no, that's something else I grabbed from the example. It said you should copy that as is.... ay ay ay. Ok, so A, B, C etc, represents the actual column names... ? I'll try that and report back.
Changed to:
[test.csv]
ColNameHeader=True
DateTimeFormat=dd-MMM-yyyy
Format=CSVDelimited
Col1=X Long
Col2=Y Long
Col3=START_DTTM DateTime
Col4=END_DTTM DateTime
Col5=Value Double
Still failed...
Regarding number 3, if, for some reason, you do skip to reading the CSV before creating the entries in an existing schema.ini file, it's really ok - ArcGIS should just append the file with some basic attributes - you can just edit with a text editor and adjust the structure as needed. You can have multiple entries in schema.ini for multiple files (in the same directory).
Also, if a schema.ini file doesn't exist, it's kinda handy that ArcGIS will create one upon first read. Good if you're being a lazy coder, lol. You can then make the edits directly in the schema.ini file and refresh in ArcCatalog/re-run your process.
Adding an ASCII or text file table—Help | ArcGIS for Desktop
from the Overriding how text files are formatted section
ArcGIS uses its own implementation for accessing delimited text file information and should handle the most common cases for displaying these files in ArcGIS. As opposed to previous releases, schema.ini files, which are used by the Microsoft ODBC Text Driver for storing data description information, are not required for displaying delimited text file information in ArcGIS. However, if a schema.ini is present, ArcGIS will honor the settings specified in a schema.ini file to determine how the text file should be displayed.
It needs to be present where the text file will be/is according to this
Can you post an example of your data? This has got to be a simple fix.