Data/SQL Guides

Adding Rows and Columns in the Data View

When a file is imported to your account, your data is transformed into a table that can be processed by CARTO. The Data View of a connected dataset includes formatted columns and indexes required for rendering your visualization.

You can manage connected datasets through Your datasets dashboard, which enables you to add rows, add columns, edit cell values, change the data type of a column, export your dataset, and even use SQL to modify your data.

For this guide, let’s look at tech companies in Brooklyn, NY and learn how a basic table schema is created. There are no files to download for this guide, as we are building data from scratch by connecting an empty dataset and adding data manually.

Create an Empty Dataset

If you prefer to create a new dataset from scratch, create an empty dataset and add metadata by adding row and column values.

  1. Login to CARTO and navigate to Your datasets dashboard.

Your datasets dashboard

  1. Click NEW DATASET.

New dataset

The Connect dataset options appear.


Create emtpy dataset

An empty dataset containing the default CARTO columns and indexes is created.

For details about how CARTO formats data, view the Dataset Basics section of the Import API documentation.

  1. Double-click on the untitled table name to rename it to Tech Co. You can also change the privacy settings, if applicable.

The dataset name context menu contains more options to manage your data. Use the Edit metadata options to include attributions about your data.

Dataset name context menu

Let’s start adding data!

Alternatively, you can use the slider button (located at the bottom of the Data View) to display the SQL view and apply data using a SQL query.

Add Rows and Columns

In this section, we will rename some of the existing columns, add new columns, and add row values.

  1. Rename the following columns:

    • Double-click on the column heading name and enter city.

    You will get confirmation message before renaming a column. The column is created using the string data type by default.

    • Double-click on the column heading description and change it to state.
  2. Add address, zip code, and company columns:

    • From the right side of the Data View, click ADD COLUMN to create a new column.
    • Double-click on the column name and type address.

You can also select the Rename column option from the column name context menu. Other options include the ability to change the sort order of the column data, change the data type of the column, and add or delete a column.

  • Add a column for zip code.
  • Add a column for company.

Add column from the Data View

  1. Add Row values:

Each row represents unique entries defined by the cartodb_id column. Any cell without data entered will be shown as null.

  • From the right side of the Data View, click ADD ROW.
  • Double-click in a row to add a value. For this example, enter the company location of CARTO as 201 Moore Street, Brooklyn, NY 11206 in each of the respective columns.

Add row from the Data View

Each row context menu enables you to edit the cell, and add, copy, or delete the row.

Change Data Type

Since certain map options are rendered based on the column data type, it is a good practice to confirm that the correct data type is assigned to the column.

This feature is especially useful since you can style map layers by column values in CARTO Builder. The resulting style options vary, depending on the data type of the column you selected. For example, suppose you want to animate a map using time-series data, confirm that the connected dataset contains a Date column.

  • When you upload your data to CARTO, it automatically assigns a data type to your column; such as string, number, date, or boolean.
  • When adding columns manually, it automatically assigns the string data type.
  1. Select Change data type from the column name context menu and select from the available options. (Options may vary, depending on your data).

For this example, keep the default String data type for all columns.

Change column data type

Now that we have confirmed that the column data type is correct, let’s create a map from the dataset.

  1. Click CREATE MAP to create a map directly from the dataset.

The connected dataset appears as the first map layer in Builder. Notice that there is no geometry since the_geom column of our dataset contains null values. No problem! We can georeference our data to convert text to geometries.

Geocode by Postal Codes

By default, CARTO stores geospatial data using the_geom column. This column displays the latitude and longitude in a single projection, using the WGS84 cartographic method. For this example, let’s visualize location data by using the zip_code column to georeference postal code points.

CHEATSHEET: Georeference Types

The following types of location text can be geocoded and applied to your data:

  • Longitude and Latitude: Generates location points using two parameter columns, one for longitude values and one for latitude values.
  • Cities: Generates location points using a single parameter column with city name values. For greater accuracy, you can specify a column to be used for the admin. region names, or alternatively, specify a column for country names. For both admin. regions and country names, you can enter custom values by typing in the name (if the data is within a single region or country. For example, manually type in and select `United States`).
  • Countries: Requires a single parameter column with country names to generate location border geometries as polygons.
  • Admin. Regions: Requires a single parameter column with admin. region names to generate location points. You can also specify a column to be used for country names (if all are unique), or alternatively, type in the custom country name.
  • Postal Codes: If your dataset consists of a column with postal codes, this option geocodes those values to generate location points. Your input data must be a text column. You can also specify a column to be used as a country names, similar to the Admin. Regions option. For specific details about how CARTO geocodes US zip codes, see the Postal Code Geocoder section in the Data Servies API documentation.
  • IP Addresses: Geocodes your data into point geometries for IP addresses. This is useful if you are analyzing location data based on a set of user’s IP addresses.
  • Street Addresses: Geocodes your data into a point geometry for a street address. You can specify the column to be used for the street addresses, in addition to the columns to be used for the city, state and country. You can also specify custom fields using the Advanced Mode.

The Georeference analysis is subject to quota limitations and extra fees may apply. Please request a demo if you are interested in enabling this service for your account.

  1. Click on the tech co map layer.

The STYLE tab indicates that there is no geometry data and provides a shortcut to georeference your data. If you switch to the Data View, you will notice that the_geom column contains null values, even though there is an address, city, state, and zip code column.

The Data View and Map View appear as icons on your map visualization when a map layer is selected. Click to switch between viewing your connected dataset as a table, or show the map view of your data..


    The ANALYSIS tab opens and Georeference is automatically selected.

  2. Change the georeference TYPE to Postal Codes and apply the following parameters:

    • In the POSTAL CODE input field, select the zip_code column from our dataset.
    • Click the checkbox next to COUNTRY. Since this dataset does not have a country column, you can add a custom column by typing United States. Click to add it as the custom value.
    • Click APPLY.
    • Refresh the map and center map on layer to visualize the results.
    • If you check the Data View, you will notice that the_geom indicates the geometry is a polygon.

    Georeference by postal code

For specific details about how CARTO geocodes postal codes, see the Postal Code Geocoder section in the Data Servies API documentation.

Editing Data from Builder

Suppose you want to edit data and add another row, you can access your dataset directly from Builder.

  1. When the tech co map layer is selected, the name of the connected dataset appears underneath the layer name as a link.

  2. Click on the tech_co link.

If you are an Enterprise user, your team name appears before the connected dataset.

Link to connected dataset

The connected dataset opens in a new window, enabling you to add rows and columns.

Any changes applied to your dataset are automatically reflected in your map. For example, if I add a row of data, the next time I refresh the map in Builder, the analysis will rerun since my dataset was updated!

Open the connected dataset and edit data