Working with databases can be a bit tough, especially when it comes to updating rows. Usually, when you import data, it adds all the rows as new, even if they’re already there. But what we really need is to update the rows that exist, using key values like the main field or primary key. This would make handling data much easier, especially when it’s from other tools.
Baserow is a relational database that lets you sort your data neatly, and it feels like using a spreadsheet. But Baserow is way stronger than a regular spreadsheet and can manage more data. If you haven’t yet, give our 60+ templates a shot. They’ll help you quickly set up databases for things like your website, CRM, apps, or CMS.
In this tutorial, we’ll walk you through the process of updating files during import processes, preventing duplication of rows, and ensuring data integrity. We’ll cover the following steps:
To complete this tutorial, you’ll need the following:
Let’s explore how to do just that.
Log in to your existing Baserow account or create a new account if you don’t have one already.
Once you log in, you can access the dashboard to add workspaces and databases. You can work with an existing workspace, database, or table, or set up a new workspace from scratch.
In this tutorial, we will set up a new workspace and create a database from scratch.
To create a new workspace, simply click on the + Create workspace button. Then, click on Add workspace.
If you’re just starting with Baserow, we recommend you read our support article on how to create a workspace and how to add collaborators to a workspace.
Now that the workspace is set up, you can either create a database from scratch or choose a template from our template library. Let’s add a database to the workspace.
Click on the + Create new button to start creating a new database.
Select the “Database” option to create a database from scratch.
Next, add a new table or click on a table within the existing database to open it. A default table will be added to the newly created database.
That’s it! we’ve successfully created a new database. Now we can populate, manage, and organize data in Baserow.
The database will contain the table we need. In this case, we have a destination table where you want to import the data. Make sure the table structure matches the fields in your data source.
When you import the data from the CSV, you can use the unique code as the key. Baserow will recognize the unique codes in the data in the CSV to match the data in the Baserow table.
Field name | Field type |
---|---|
Unique name | Single line text |
Name | Single line text |
Phone | Phone number |
Within your Baserow user account, you can create multiple unique database tokens that allow Baserow to connect with other apps. You can create and find the database token under your account settings.
Database tokens provide similar functionality to login credentials, but they provide additional security and flexibility. A token, like your username and password, should be kept secure and handled with the utmost confidentiality.
Creating database tokens is available to all Baserow users; you don’t need to be on a paid plan.
Next, specify the data source you want to import from. This might involve selecting a file, connecting to a database, or providing a URL. It could be a database, a spreadsheet, a CSV file, or from a web service.
Ensure that your data source is accessible and formatted correctly for importing. If necessary, clean up the data to remove any inconsistencies or errors.
In this case, let’s use a csv file. Once we have our list, we can import these to update the corresponding rows on Baserow. When the CSV data is imported, we use the unique code as the primary key.
To get started, create a new Make account or log into your existing account. Then create a scenario and add modules to the scenario.
Select the app that will trigger your scenario. Click the first +
button and select CSV as the trigger app.
Choose one of the actions from the list. In this case, select the Parse CSV action.
The Parse CSV transformer lets you parse a csv text from a received text value or a file. If your data comes in binary form (typically from a file), you have to use the
toString()
function to convert the binary data to String:
Configure the module.
Click OK to save this module and Run once to test the connection.
Now, let’s view the data in our Baserow table.
We want Baserow to recognize that the unique code in the CSV data matches the data already in the list.
+
button and select Baserow as the trigger app.https://api.baserow.io
, otherwise, replace the URL with your self-hosted URL.You should get a response back that resembles the following:
Now, let’s have Baserow read and link the unique codes in the existing rows to update when we import data into the Baserow table.
Once the data source is connected, we’ll need to map the fields from your data source to the corresponding fields in the destination table. This ensures that the data is imported into the correct columns.
We’ll use the same database as in the first Baserow module. But, the table ID will be the one we want to store the data.
+
button and select Baserow as the app.Our scenario is set up and ready to activate, but we may still need to run a quick test. Run the scenario, Make will load the prompt and store the data in the Baserow database. After the import is complete, review the imported data to ensure that everything looks as expected.
Let’s jump back to Baserow. Check your Baserow table for the responses!
Specify when and how frequently an activated scenario runs. To do so, go to the scenario detail page and locate the Schedule tab or click on the clock icon to set a preferred schedule.
To set the schedule, adjust the Run scenario to set the time when it should run.
Save and activate the scenario by toggling on the scheduling switch at the bottom left corner.
Make offers advanced options like conditional logic and filters for more complex scenarios. You can add filters to the CSV trigger and Baserow action to only process specific data. Explore the “Update Rows” action in Baserow if you need more granularity over field updates.
Explore Make’s other features like multi-step modules for advanced automation and define how Make handles errors.
This tutorial shows you how to match unique IDs in your spreadsheet with rows in a Baserow table using Make. You can tweak it for your own spreadsheets and tables. By following this step-by-step process, you’ll be able to link your data to Baserow automatically. This saves time and helps keep your data correct and consistent.
The following articles may also be helpful:
In case you’ve run into an issue while following this tutorial, feel free to reach out to ask for help in the Baserow community.