This question already has an answer here:

I'm working with QGIS, v. 2.0.1. I opened a csv-table (from an Excel-file) and now the precision is very high but I don't need this. At the moment the values are for example 15.00000000000000, how can I change this to 2 decimals? And is it possible to set the precision before I open the table in QGIS?

The methods suggested by simo just worked partially... I opened the table and it looked good but as I wanted to create a shapefile of the layer the precision switched back to many decimals. What can I do?

There are only two decimal places in the csv file and there are also only two decimal places when I load the csv file into QGIS. But as soon as I create a shapefile, there are 14 decimal places.

marked as duplicate by Simbamangu, AndreJ qgis Dec 27 '15 at 16:37

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


Method A

You can create a new field (real) to the table specifying wanted precision.

Then just copy the original field value to the new field with the QGIS calculator : https://www.qgis.org/en/docs/user_manual/working_with_vector/field_calculator.html

See the screenshot below : enter image description here

Replace the expression by the original field name.

Method B

Another option would be to handle everything out of QGIS, by specifying types into a dedicated CSVT file. Underdark wrote about it on her blog :


Your file would look something like that for 2 decimals precision :

  • So under "expression" would just be the name of the column? (In my case, i have a column called "Pb"). And do you know how i can define the precision so that i don't have to create new fields all the time i want to open an attribute table. – qgs Mar 10 '14 at 13:27
  • Acctually it didn't work...i opened the table and it looked good but as i wanted to create a shapefile of the layer the precision switched back to many decimals. – qgs Mar 10 '14 at 13:50
  • Regarding method A, everything is mentioned on the screenshot. You can retrieve attribute values from the "Function List" field. – simo Mar 10 '14 at 14:18
  • One way to do it would be to edit the file in Excel. Right click on the column header and select "Format Cells." Then select "Number" for the category and change the decimal places to what you need. Then save it as a new csv file. – midfield99 Mar 10 '14 at 14:21
  • I already did this before creating a csv file. – qgs Mar 10 '14 at 14:52

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