I'm trying to add a table in QGIS but I cannot define the datatype of my fields, as when imported they get automatically "read" as string.

I have tried to add a csvt file, by filling a .txt with the datatype of each column/field, as follows:


I saved the file with the same name of the CSV (but followed by the new extensions) and saved it in the same folder containing the original CSV file, as follows: file_name.csv and file_name.csvt.

I have tried to import the CSV by "Add delimited text layer", "Add vector layer", and browsing and dragging the file directly in QGIS. The imported file's fields are still all strings.

Not sure if this is relevant but my computer doesn't recognise the csvt file format and still reads it as a .txt file.

What am I doing wrong?

  • 2
    Would be helpful to see a sample of your data (update the question to include a screenshot). Also check if you really have only numbers in your Real and Integer fields, no other characters.
    – Babel
    Commented Dec 24, 2020 at 15:50
  • 3
    You've got some missing quotation marks in your CSVT format - specifically there's no opening quote on the second and third item.
    – Spacedman
    Commented Dec 24, 2020 at 16:12
  • Yeah sorry guys, it was a bad copy&paste, but it was actually written correctly in the .txt file but still not working Commented Dec 25, 2020 at 19:30

1 Answer 1


Seems the problem was related to my computer not being able to read a csvt file.

I downloaded a .csvt file from a public github space, then edited with my datatype inputs and now it works fine on QGIS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.