Turning Spreadsheets into Structured Databases with Tadabase
Hey there, it's Tim from Tadabase, and welcome to another exciting episode of Build It with Tim!
In this tutorial, we're diving into the world of data importing from CSV files using Tadabase. Our goal is to take a CSV file with company data and transform it into a fully functional data table within your application. We'll cover the key features needed for this process and guide you step by step.
Imagine you have a spreadsheet with company data. You want to transform this data into a dedicated data table, with connections to other tables, for efficient data management.
The first step is preparing your CSV file. Export your data as a CSV and head over to Tadabase's database builder. Here's where the magic begins.
You can create a new data table from scratch by clicking "Add Data Table." But if you're working with an existing CSV, use the "Add Table from CSV" option. Specify the table name and select the CSV file. If the CSV has headers, you can easily define them.
For our company data, we'll first import company names into a separate data table. Next, we import the entire spreadsheet and connect it to the company data.
After importing the company names, create another table for company data. During import, map fields accurately. Use connection fields to establish relationships between tables. For data types like select or radio fields, define options based on CSV values.
Tadabase makes it easy to set up a complete data structure. You'll have valid connections between tables, allowing you to dive into the page builder and start working with your data.
Creating tables and importing data is just the beginning. To streamline data importing, build import templates. These templates guide Tadabase on how to handle imports. Define the fields and map them to CSV columns. Ensure that the values match precisely.
For dynamic data importing, add an import component to your published application. Users can now import data directly. You can even choose to update existing records or create new ones based on matching criteria.
And that's the power of data importing with Tadabase! Whether you're building initial data structures or enabling users to import data effortlessly, Tadabase offers a range of options for powerful data management in your app.
Thanks for joining us on this episode. Stay tuned for more exciting tutorials coming your way. Until next time, take care and keep building with Tadabase!
Features Discussed:
-
Data Table With CSV File (Time: 2:00)
Understand the process of importing a CSV file into Tadabase to create a data table. For example, learn how to separate unique company names into their own table and then link them to company data in another table. -
Data Table With CSV File (Time: 3:09)
Learn how to set up connections between different tables while importing data. For example, learn to connect a "Company Data" table to a "Companies" table, ensuring a relational structure. -
Import Templates (Time: 6:00)
Learn the process of setting up import templates in Tadabase. Learn how to map CSV fields to your data table fields accurately. For example, you'll discover how to ensure that the data imported from a CSV file correctly matches the fields in your Tadabase database.
Transcript Summary
Introduction
Hey everybody, this is Build It with Tadabase. On today's episode, we are going to start from scratch and learn how to import from a CSV to create new data tables inside of your application, as well as how to utilize the import functions in general inside of Tadabase.
Preparing the Data
For demonstration purposes, we are going to use a company data spreadsheet with five columns. Starting from the left, we have company name and then various company data that we want to track. Ideally, we want to turn this spreadsheet into its own data table inside the Builder, with a connection to a company where these company names are stored in another data table.
To do that, the first thing I need to do is a bit of pre-work by separating out all the unique company names and storing them in a different spreadsheet. I'll import my company names first into its own data table, and then I can import the full sheet here and automatically make a connection to the company.
Importing the Company Names
I've made sure that I've exported these spreadsheets as a CSV. Once I have them in CSV format, I can hop over to the Tadabase Builder and get started.
Inside the Builder, there are a couple of ways to create data tables. The first is to click the big button that says "Add Data Table." This allows us to define our table name and create an empty table where we can start adding fields. However, when working with existing data in a CSV, we can use a special function under the dropdown called "Add Table from CSV."
Clicking on "Add Table from CSV" will open a new window where we can define our table name and select the CSV we want to import. I'll start with a list of my companies. We can specify whether the CSV has headers on row one (which in my case, it does), leave the delimiter as is (unless you have a different delimiter), and then choose "Upload."
Now, it's going to ask us to map the fields to create new fields for each column within our CSV. I only have one column in this instance called "company name," and I'll simply make it a text field. Once I click "Save," it will import the CSV, create the field, and then import all of the records.
Importing the Company Data
The reason we created our company data table first is that when we import the next section, which is the full spreadsheet or CSV, we need a company record to exist before we can make a connection to it.
The next step is to repeat this process, but this time we will create a different table called "company data." We can select our spreadsheet or CSV and choose "Upload" once again.
When defining the field types that we want to include, we intend for the company name to be a connection to the company in the company table. We have that option through the Importer window at the bottom, where we can set a connection based on the company name. I'll create a connection field into the company's table and connect to the company name.
For the next three fields—employee turnover rate, profit margin, and customer satisfaction—I intend for these to be select or radio fields. We can choose that in our field configuration dropdown. What it will do is create options inside that field for all the possible values in our CSV (e.g., high, medium, low). I'll go ahead and choose radio for these three fields, and leave the date exactly as date.
Finalizing the Data Table
Once we're finished, you'll see that we have a completed data table just like before, but with more information and valid connections automatically set because we imported our companies first.
In just a few minutes, we have a fully functioning data structure set up and created inside our application, which allows us to jump right into the page builder to start adding pages to add and manipulate our data. For example, if we wanted to add a table to view all our company data with a form to add new records, we can do that quickly and easily. Here's all our data that we just imported, with a form that allows us to add new records.
Importing Additional Records
The next step for this walkthrough is how to import additional records into this table now that everything is already set up and created. We can go back to the data builder, go into our table, and choose the import option. We can redo the entire process, but this time we're not creating the table from scratch or creating fields—we're simply importing and potentially matching values that we already have in order to update or create new records.
However, maybe we want to give our front-end app users the ability to do these imports themselves. Perhaps more than one person on your team is responsible for these types of imports. We can use the same importing functionality inside the live published application rather than inside the Builder.
To do that, we'll head back to our Builder for a few moments and go to the Automation tab. From there, we'll choose "Import Templates" and add a new template. What a template does is prep the configuration, telling Tadabase how the import should be handled. We can give this template a name—I'll call it "company data"—select the data table we want to import to, and then map our fields.
Setting Up the Import Template
For such a small data table, I'll choose "Add All Fields." On the left side, you'll see the fields within our data table, and on the right side, you'll see a space to enter the column names from your CSV. It's incredibly important that the names you put on the right side match exactly what's in your CSV.
When defining the connection fields we want to map out in this import, we need to be extra careful to select the right field from the connected table that we're using a value from in our CSV. For example, we know that in our CSV, we are storing the company name for each row from our company data CSV. When bringing in that data, we need to make sure we're matching it to the company name inside the company's table and not any other company field.
Once we've ensured that all the values on the right-hand column match exactly to the headers on our CSV, we can hit "Save," and now we have our import template created. From there, we can go back to the Page Builder and add this as a component inside our page.
Using the Import Template in the Application
We'll select the import component, choose the data table we want to import to, and then select any available templates for that given data table. Now that we have that created, when we go back to our published application, you can see a big button at the top. We can now run through this whole import wizard directly through the published application.
For example, if I import the CSV again, we're going to create an additional 150 records or so. What I can also do is go back to our Builder, into the import component, and choose whether or not we want to match any existing fields with our CSV. When we choose a record value to match against with our CSV, what will happen through the import process is that if that value matches, we are going to update the record. If it doesn't match, we're going to create a new one.
Conclusion
As you can see, the import process is super powerful and functional inside your Tadabase application, whether you're using it to create your initial data tables and data structures or you want to add an import component to the front-end pages of your published application. You have a lot of options to choose from and a lot of power to take advantage of.
We'd love to hear your feedback.