Feature request #5606

Defining column types for CSV imports

Added by Kenton Ngo almost 12 years ago. Updated almost 6 years ago.

Status:Open
Priority:Normal
Assignee:-
Category:Data Provider/Delimited Text
Pull Request or Patch supplied:No Resolution:
Easy fix?:No Copied to github as #:15179

Description

At work we use Mac OS X. Microsoft Office for Mac no longer supports DBF exports, and much of our data that we'd like mapped lives in Excel-compatible files.

I'm currently exporting as CSV using this workaround, but it requires me to create a CSVT file, an annoying extra step. http://underdark.wordpress.com/2011/03/07/how-to-specify-data-types-of-csv-columns-for-use-in-qgis/

Is there any way to eliminate this extra step by allowing a user to define the column types at import?


Related issues

Duplicated by QGIS Application - Feature request #13038: Add ability to choose field type in CSV plugin provider i... Open 2015-06-26
Duplicates QGIS Application - Feature request #4212: Data types for csv Open 2011-08-23

History

#1 Updated by Paolo Cavallini over 11 years ago

  • Target version set to Version 2.0.0

#2 Updated by Pirmin Kalberer over 11 years ago

  • Target version changed from Version 2.0.0 to Future Release - Nice to have

#3 Updated by Karolina Alexiou about 9 years ago

I will work on this. Longs getting casted to floats from csvs has been an inconvenience for a while. Plz somebody with permissions assign this to me, thanks.

#4 Updated by Matthias Kuhn about 9 years ago

Can you add a short description about your plans. Which datatypes exactly do you want to support (Int/Long/Float/Double) and will there be auto-detection of some kind of these types or what is the workflow?

#5 Updated by Karolina Alexiou about 9 years ago

The workflow would be to allow the user to force a data type for 1 or more columns. Basically I am thinking of adding another row to the UI when importing delimited text layer where the user would be able to select Int/Long/Float/Double/String or Autodetect(default). Right now there is autodetection, but it doesn't always work right. I could also see if there is some obvious improvement to be done in that.

#6 Updated by Giovanni Manghi about 9 years ago

  • OS version deleted (1.9)
  • Operating System deleted (Mac OS X)

#7 Updated by Jukka Rahkonen about 9 years ago

Perhaps you could use ODS format instead? GDAL and Excel both can read and write the format http://www.gdal.org/drv_ods.html.

#8 Updated by Karolina Alexiou about 9 years ago

Not really applicable to us, we just want more control over importing raw text files (unlike the original poster).

#9 Updated by Karolina Alexiou about 9 years ago

https://github.com/qgis/QGIS/pull/1957

I made a pull request to QGIS upstream which improves the autodetection by also adding long types.
No work yet on forcing the type from the import menu.

#10 Updated by Médéric RIBREUX over 8 years ago

  • Category set to Data Provider/Delimited Text

Hello, bug triage...

the PR has been merged.

One good idea (on the GUI part) would be to try to make the delimited text provider act like LibreOffice Calc csv importer:

  • there is a QComboBox with the list of each type.
  • When you select a column, you can use the QComboBox to define the type of the selected column.

We just need a way to display the manually defined type of columns (upper or above the column name), but I am sure it's feasible.

#11 Updated by Giovanni Manghi almost 7 years ago

  • Easy fix? set to No

#12 Updated by Johannes Kroeger almost 6 years ago

Ultimately this is a dupe of #4212

#13 Updated by Jürgen Fischer almost 6 years ago

#14 Updated by Jürgen Fischer almost 6 years ago

Also available in: Atom PDF