1

I import a CSV file on Qgis.

In excel I see an incription like that ¨54235¨ and in the attribute table in qgis as well as in notepad it looks like that ¨ 54 235¨ *not space but tab.

The column when it was an excel file it was created like text join (e.g: =A11&B12)

The initial columns A & B as well have the same problem (e.g. ¨012¨ apears ¨ 012¨ with a tab.

Do you know a solution to that problem?

3 Answers 3

2

In your excel spreadsheet copy the column with the values in it, then using "paste special" select "values". If this doesn't work you can remove all unnecessary spaces in your excel sheet before saving as a csv and importing. To do this you can use the find and replace function: open find and replace, put a single space in the "Find what" box and nothing in the "Replace with" box. You can then use "Replace all" to do all of them in one go or go through each in turn if there are other cells in the your document you don't want to remove the spaces from. Alternatively in an adjoining column you can use the "Substitute" function to remove all spaces. The syntax for this would be 'Substitute(A1, " ", ""). This can be copied down the column and then use the copy and paste values for this column to overwrite the original values and delete the column with the equation in. If you only wanted to remove the spaces at the beginning and/or end of the string in your cell then you cold use the "Trim" function. The syntax for this would be 'Trim(A1)'. Hope this is more helpful than my first answer!

3
  • Hi Phil. It sounds like your trying to describe pasting values over the formulas. Could you add a little more detail to your answer. It's easiest going step by step through your whole process. Also include the trim function. Remember that though your answering Dioni's question directly, it could also be the answer for hundreds of other people too. You can never have to much detail in an answer Commented Jun 6, 2016 at 14:16
  • Hi Phil, I do not see the spaces in excel only in word pad and in the attribute table. Seems to be a file recognition theme
    – Dioni
    Commented Jun 6, 2016 at 14:46
  • Hi Dioni, in that I am not sure how to fix the space being generated in the center of the string. However if in the Calculating field in QGIS you use the trim function with the same syntax as for excel (but change the cell number to the column name) that will remove the spaces at the beginning and end. You could try the excel edit I suggested and save again as a csv and see if that does anything?
    – Phil
    Commented Jun 6, 2016 at 15:13
0

In QGIS use Calculating field for table and remove space with trim fonction and replace fonction.

2
  • Hi kosner! As you can see at the post I do have now a postproblem. In Qgis I can see only this ¨...¨
    – Dioni
    Commented Jun 6, 2016 at 14:53
  • Do you try to make the concatenation of two fields directly in your QGIS?
    – kosner
    Commented Jun 6, 2016 at 15:10
0

It was not a space but a tab.

They way to fix it is with Replace in Notepad++.

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.