This tutorial will walk you through how to build a Bulk Import Tool that adds records to a database using a CSV file. This tool reads and writes to your database or API.
In this tutorial, you will need to connect a data source with read and write permissions containing user account data. This tutorial uses a PostgreSQL database and the functions generated by Internal include: list user_accounts records and insert user_accounts records.
Operations • Customer Support • Product • Engineering
Build from a handful of drag-and-drop components
Create or update many records at once via a CSV/TSV upload. This component also allows you to complete bulk actions for selected rows of a Table component.
Displays a list of records in table format. Customize the layout with flexboxes, image components, buttons, and more.
How to build:
Bulk Import Tool
Drag and drop a Table component into your Space and configure it with the function List user_accounts records to display all user accounts in your database. Next, sort by created_at in descending order so that all new records are listed at the top.
Drag and drop a Bulk Action component which will allow you to execute the CSV upload. In order to add new records, you’ll need to configure this component with the function Insert user_accounts records. Set the source to File Upload since you’ll be using a CSV to make changes to the database. Select the fields that you will import into the database: company_id, email, first_name, last_name, created_at, and onboarding. Next, you will need to configure email, first_name, and last_name so that these values come from the CSV.
For the created_at, set this to the date and time the button was clicked so that it’ll automatically update. When a new record is created in the database using this import tool, the onboarding status will be set to active.
Lastly, you can configure the table to refresh when the bulk import is completed to indicate to the user the import was successful. Under the Effects tab, configure the table component to Refresh on Successful Submit.