When I need to add a data column to a DBF, I always download the shapefile, open the DBF with OpenOffice for Mac, us a VLOOKUP( ) to add my data to a new column, re-save the file as a DBF, then open in in QGIS and that's never not worked for me.

When I do that now, I'm getting an error. I'm using this TIGER/Line Shapefile of Pennsylvania zip codes (.zip), which works fine if I put it right into QGIS and start working with it -- then I add the new column of data, but the second I try to re-save in OpenOffice, it gives me this error (regardless of whether I add the column or not):

enter image description here

The cell it's referring to is simply "108807," so I can't reduce the decimal points that aren't there. I tried re-copying and pasting as values and it didn't fix it either.

So my two questions are:

  1. Does anybody know how to fix this so I can continue using my simple/preferred method of OpenOffice?

  2. Or can anybody direct me to another way to join the new column I need onto this DBF if it's currently a csv file that can be matched with a unique identifier on the original DBF? (I read something on here earlier about being able to do this with R, but I couldn't figure it out.)

Thanks for the help!


You can join .csv file to your shapefile attribute table by (as you wrote) matching unique identier (ID or something else)

  1. add your .csv file to project same way as a layer
  2. add your shapefile
  3. open shapefile properties (right click -> "Properties")
  4. click on "Joins" and then add join via green + button
  5. as a layer select your csv file, in join and target field select unique identifier (for examplle ID)

if you need you can export the shapefille with joined attributes in table by right clicing -> "Save As...". hope this helps you

  • Thanks -- that worked! I tried something very similar to that earlier but it didn't work because instead of adding it like a shapefile, I was adding a text delimited layer. Thanks again! – Ryan Oct 23 '14 at 20:12
  • Ah, actually -- it worked in the sense that when I look at the attribute table, all the new data is in and correctly matched up -- but the reason I put it in was so I could do a graduated color ramp based on the column I added, and for some reason the only options I'm getting are from the initial file, not the one I joined. Any ideas on how to fix that? – Ryan Oct 23 '14 at 20:16
  • It seems like it's because it's not accepting them as numbers -- QGIS must think it's a string or something. – Ryan Oct 23 '14 at 20:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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