I have .xlsx dataset file with column "Country Name" and "Country Code" which have text records. I would like to geocode (assign) it to adequate country polygon in batch mode. The expected result should be a polygon of the country with attributes as columns from .xlsx.


Carto.com geocoder has such function (country geocode), however it is strictly limited to couple hundreds records and I have more than 6000 of it.

I am able to use QGIS and ArcGIS.

  • 1
    Please add the GIS software that you are using.
    – ahmadhanb
    Feb 13, 2019 at 12:08
  • I am able to use QGIS and ArcGIS.
    – sk1me
    Feb 13, 2019 at 18:36

1 Answer 1


Here is one option:

  1. Download and install QGIS (free GIS software)
  2. Download a country polygon layer/shapefile that has a field that defines the names
  3. Convert xlsx to csv
  4. Add country polygon layer into Q, open attribute table, start an edit session, create two new fields called XCent, YCent and populate each field using field calculator the geometric centroid coordinate of each feature (e.g. expression x (centroid($geometry))) and save edits
  5. Load in csv into Q as a delimited text layer (no geometry) and via the layer properties perform a table join between common country name fields between both layers and export csv as a new csv containing the polygon XCent and YCent fields
  6. Load new csv into Q as a delimited text layer and use the XCent and YCent fields to plot the points

This should produce a geocode point feature for each country record (that joined successfully) in the csv. For countries with multiple records there will be many points on top of points.

  • Ok, so you propose simple attribute join, that's a good way. However you need a good dataset of country polygons (good names of the countries). What is more, I would like a polygons and I get points...
    – sk1me
    Feb 14, 2019 at 14:07
  • Yes, the country polygon layer name field values will have to match what you have in your table. You may have to make manual updates in either dataset so they match/join correctly.
    – artwork21
    Feb 14, 2019 at 18:32

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