5

I've imported a Delimited Text File that I want to join to a shapefile.

Unfortunately, the join field has a ' character before the actual string.

I wanted to delete that character, but I can't edit the file because I get:

This layer does not support adding new provider fields

Consequently, I cannot edit the file (and yes, I toggled the layer editing icon on and tried editing it after saving the imported CSV with a new name).

Is there a way to get around this?

10
  • can you edit the file name outside of QGIS? for example - in Excel or Google Sheets?
    – MDHald
    Commented Feb 9, 2016 at 20:19
  • I can. I just did it using TextWrangler. This is still puzzling me though...
    – sig_renato
    Commented Feb 9, 2016 at 20:35
  • 1
    ArcGIS has similar problems (as most RDBMS) in utilizing non-alphanumeric file names...its just good practice to avoid them entirely. That said, it doesn't really answer your question as to why you can't edit the field name in QGIS. That I will leave to someone else to answer as I am not sure of good resources on that topic.
    – MDHald
    Commented Feb 9, 2016 at 20:38
  • 1
    @Alesandre Neto, my fellow countryman, I am.
    – sig_renato
    Commented Feb 12, 2016 at 13:52
  • 1
    @sig_renato, I have updated my blog post about how to use Censos 2011 data in QGIS, have a look: sigsemgrilhetas.wordpress.com/2013/05/07/… Commented Feb 14, 2016 at 16:38

3 Answers 3

6

Editing CSV files inside QGIS, AFAIK, is not possible.

Never the less, while importing the CSV with the add delimited text tool, you have a option to choose what characters to ignore.

If your data does not have any ' beside the ones on your problematic strings, you can simply add that characther to that option and it will never be imported in qgis in the first place.

If within your strings the ' character is used elsewhere like in I'm then you will need to use the regular expressions option.

On the other end, also while importing the CSV using add delimited text, you might want to use the watch file option. This way you can do changes in the CSV file (outside QGIS) and they will be updated as soon as you refresh the map canvas, or reopen the attribute table.

1
0

' character is common when we export a table from .xls or .xlsx to .csv or .txt

Some programs just ignore it, so you don't see it when you open your file, but you can solve it by opening your file on a text editor (such as Notepad) and delete the ' character. Just do Find "'" & Replace by "" (nothing).

Save your file and it should work.

rnmendes

0

Even easier still is to use your spreadsheet software (eg Excel) to "Find" and "Replace". Just find ' and leave the replace box blank, like this:

enter image description here

Then click "Replace all.

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.