CSV File Import

Xano's CSV file import is ultra-robust. Import your file with confidence, even if you have millions of records. The import process runs on Xano's special import service, which has dedicated resources separate from your instance, so it can handle all of your data no matter how large it is.

The CSV file import allows you to create a brand new table from scratch and will generate the schema automatically. Additionally, you can edit existing records if the file can be mapped to a primary key or append data to an existing table.

Uploads over 5,000 records will be performed in the background. You can easily monitor the import's progress in the settings of your workspace and will be notified on Xano and via email when the import is complete.

Add a New Table

From the database select Add Table.

When the right panel opens up, select Import and choose the CSV file option.

Next, drag and drop a CSV file onto the uploader or browse the files on your computer for the file you wish to upload.

Once you select a CSV file, the preview of your CSV will open up. The preview will display the first 100 rows of your file. You can make any final adjustments here before uploading the file to Xano.

Choose a table name

Set a field as the Primary Key

Xano will try to automatically detect a primary key field. Currently, only integers are supported for the primary key field. The drop-down will show any fields compatible to be a primary key. If there is no primary key, then Xano will create the primary key automatically.

Make any changes

Lastly, you can select a column to change its data type, disable it (if you do not want it included in the upload), or re-order the column's position.

Upload and finish!

Once you are ready select upload! If you are uploading over 5,000 records then your upload will be performed in the background. You can monitor the progress of your upload from the settings page of your workspace. Once your background upload is complete a green banner will appear notifying you to refresh your browser and an email notification will be sent with confirmation of a successful import.

Add to an Existing Table

Choose the table you want to add data to via a CSV, select the menu icon in the top-right, and select CSV Import.

Drag and drop a CSV file onto the uploader or choose a file from your computer.

Next, a preview of your CSV will appear. The first 100 records will be displayed. Review the mapped columns before selecting upload. Any column headers in green will show automatically detected mapped fields. To make a change, select a column and choose a different column to map to. You can also select create a new column if you need to create new schema for the table.

Hit upload and finish!

Edit Records in an Existing Table

To edit an existing record the CSV file must have a primary key. The primary key will be mapped to the primary key of the existing records to make the updates. Currently, only integers are supported for the primary key field.

If there is no primary key to map to the existing id field the CSV file will add new records to the table.

Be sure to review the column mappings before uploading. Xano will search for a column in the file called ID. However, double check this field. If your ID field is called something else, click on the column and choose to map the column to the existing ID field.

You can make changes to any of the columns mapping's by clicking on the column header. Green will show a compatible mapping to a field. Any red headers indicate an unmapped column. Finally, you can also select create the column if you need to create a new column on the table.

Valid CSV File Format

It's important that you use a valid CSV file format in order to successfully import your data. If there is an issue with initiating the upload then this could likely be the issue.

What is a valid CSV file format?

A CSV stands for a comma-separate file, which is a delimited text file that uses a comma to separate values. The importer does not support other separators, such as semicolons. Each line of the file is a data record. Each record consists of one or more fields, separated by commas.

  • The first row must contain the column names - not the file name or any other data.

  • The second row begins the values. They should be in the same order as the columns they belong to.

  • Each row should have the same amount of values as there are columns.

  • Enclosure characters are required when working with text strings that contain quotation marks. This is because if a quotation mark is detected, this is typically something that would mark the beginning or end of a value. You can use a double quote ("") to dictate if a value should contain this quotation mark somewhere inside the value.

  • CSV files should be UTF-8 encoded. If you're having trouble importing your CSV properly in Xano and have determined you are using both the proper separator and enclosure characters, please make sure your file us UTF-8 encoded. This ensures that there are no special characters that might not be supported in Xano.

UTF-8 Encoding in Notepad (Windows)
  1. Open your file in Notepad.

  2. Click File > Save As...

  3. Click "Save As Type", and choose All Files.

  4. Click "UTF-8" in the Encoding dropdown.

  5. Save the file.

UTF-8 Encoding in Google Sheets (All platforms)
  1. Open your file in Google Sheets

  2. Click File > Download > Comma separated values (CSV)

  3. The file will be downloaded in CSV format using UTF-8 encoding.

UTF-8 Encoding in Numbers (Mac)
  1. Open your file in Numbers

  2. Click File > Export To... > CSV

  3. In the "Text Encoding" dropdown, choose UTF-8

  4. Save the file.

How can I check my CSV file format?

You can review the format of your CSV file format in a number of ways. Open the file in Text Editor, Visual Studio Code, or another code editor. You can also do an online search for CSV file format validators and use an online service.

How can I edit my CSV file format?

Tools like Text Editor, Visual Studio Code, and other code editors allow you to make any necessary edits to your file and save the changes. When opening the file from your computer, right click and choose open with to choose from the different options available on your computer.

Last updated