Sometimes I need to import large spreadsheets into MySQL.
The easy way would be to assume all fields are varchar, but then the database would lose features such as ordering by a numeric field.
The hard way would be to manually determine the type of each field to define the schema.
That doesn’t sound much fun so I created the below solution to automatically define a spreadsheet schema by analyzing determine So to address
csv2mysql.py automatically parses a CSV file, creates MySQL table with appropriate field types, and then writes CSV data to the table.