How to import geographic data into Tableau Desktop: Geocode.csv vs Shapefile.shp

In Tableau Desktop, importing geographic data is sometimes required to create visualizations based on maps. Two common methods are available: using a file CSV containing custom geocodes Or a Shapefile file. Each has its advantages, limitations, and its own import process.

In this article, we'll compare these two approaches, while providing you with detailed tutorials for each.

1. What is a Geocode.csv file and a Shapefile.shp file?

Geocode.csv

A geocode CSV file contains tabular data that associates geographic locations (such as city names or regions) with their geographic coordinates (latitude and longitude). This format is lightweight and practical for simple needs.

Use case: Create a map with specific points (for example, corporate branches or points of interest).

Shapefile.shp

A Shapefile is a geospatial format used to represent complex shapes such as regions, borders, or areas of density. It includes several complementary files (.shp, .shx, .dbf) to define both geographic data and its attributes.

Use case: Create complex maps with custom areas or show administrative boundaries.

2. Import a Geocode.csv file into Tableau Desktop

Step 1: Prepare your.csv file

Your file must contain at least:

  • At least one column for the names of the places (e.g.: “City”) already present in the dataset used,
  • A column for the latitude (e.g.: “Latitude”),
  • A column for longitude (e.g., “Longitude”).

This.csv file must be stored in a folder before it can be imported into Tableau.

CSV file example:

Note: You can prepare your data in an excel document that you save in a.csv format.

Step 2: Connect Tableau to the.csv file

  1. In Tableau Desktop, click Map > Geocode > Import and select the folder where your CSV file is located.
  2. Change the Canton field data type to the new imported geographic role.

We can see here that a new geographical role has emerged and allows the cantons to be displayed on the map in the form of a point.

3. Importing a Shapefile into Tableau Desktop

Step 1: Prepare your Shapefile

A Shapefile consists of several files, the main ones of which are:

  • .shp : Contains geometry.
  • .shx : Spatial index of geographic data.
  • .dbf : Attribute database.

Make sure you have all the required files in the same folder.

Note: There are many open source Shapefile files on the Internet via sites such as those of INSEE or Open Data Soft. Unless you have a specific need, I advise you to search for an existing Shapefile file.

To create Shapefiles, you can go to QGIS (https://www.qgis.org/), ArcGIS Online (https://www.arcgis.com/), or Geojson.io (https://geojson.io/).

Step 2: Connect Tableau to the Shapefile

  1. Open Tableau Desktop,
  2. Click on Connect > Spatial File,
  3. Select the file .shp in the file explorer,
  4. On a sheet, drag the field Geometry.

We now see that the cantons appear through a geometric shape allowing their territories to be observed and no longer as a point.

You can then join with another source file to feed your data.

4. Comparison: Geocode.csv vs Shapefile.shp

5. Conclusion

  • Use a CSV Geocode if you need to visualize specific geographic points, such as office locations or GPS coordinates,
  • Prefer the Shapefile for more complex visualizations involving areas or shapes, such as maps of regions or custom territories.