I have a point layer representing sites where data was collected. The data was edited and stored in an Excel spreadsheet (CSV). I needed the data to be joined to the sample sites. I followed the steps mentioned here: Joining data from Excel to attribute table in QGIS without creating duplicates? And it worked. However, when I attempted to load the same layer in a different project, the data from the spreadsheet was not there. It seems that the joined data was not permanently added to the attribute table of the shapefile. Is it possible to make these additions from the spreadsheet permanent to the shapefile?
-
2Create new columns for the shapefile which contain the joined data. Or repeat the join.– ErikMay 5, 2021 at 12:08
-
2It's joined on load. You would need to repeat the join in the new project. Did you try exporting the layer? I don't know if that works.– wingnutMay 5, 2021 at 12:15
1 Answer
The join is only permanent within the project you did the join in; basically the attributes are just linked and the link information is stored in the project file (.qgs or .qgz). If you want to hardcode the joined attributes in a layer, you need to export the joined layer as a new file via right clicking on that layer and choosing export -> save features as. Note that if you do so and change data in your excel file, the hardcoded attributes in the join-layer do not get updated any longer, they will keep their values they had when you saved the file.
Alternatively you can also run Join attributes by field value
from processing toolbox which automatically generates a new layer (be careful: the output is temporary by default. You will loose it when closing QGIS. So you also need to save this one to your harddisk)
Keep Shapefile limitations in mind! Fieldnames can have a maximum length of only 10 characters. I suggest to use another file format like Geopackage for example. If you are required to save it as Shapefile, you need to rename the fieldnames. To do this you can run refactor fields
from processing toolbox, give the fields a new name with max. 10 characters and save the output of this tool as Shapefile.
-
1When saving feature as the field names changed to Sam_#. and then using "Join attributes by field value" the fields were added but none of the values, so I had an empty table. May 5, 2021 at 13:47
-
2typical shapefile issue: fieldnames can be max. 10 characters long. I suggest to use another file format like geopackage. If that is not an option for you, run refactor fields tool before saving as shapefile and rename the fields so they have max. 10 characters. May 5, 2021 at 13:51
-
1