How to link CSV upload records with form data

Hi, I am have a form that has the following inputs:

  • Sale No
  • Sale Date
  • Broker
    *Upload CSV file

The CSV file will contain multiple records listed as rows.

My goal is i need for each CSV record to map the sale no, sale date and broker inputs - this needs to be done on my bubble db.

Need this to be done by user from a user interface.

Appreciate your help. TIA

Hello!

You can set up a file uploader input element, and then a button that triggers the workflow action “upload data as CSV.”

The “upload data as CSV” workflow action should achieve this for you. There are a few things to keep in mind when using this action:

  • The column headers of your CSV must match exactly the field names of your data type - this is case sensitive.
  • The data entered in each row of the CSV must be valid data. For example, if a field is a number field and the data entered is not a number value, the workflow action will return an error.
  • If you have fields on the data type that connect to other data types, those records of the other data type should already exist, and you should use the unique IDs of the record. Bubble will then automatically recognize the correct records.
  • Lists of things need to be formatted in the spreadsheet as a JSON array - for example: ["item 1","item 2","item 3"]

I hope this helps!

I am clear about the upload file option.

My interface has 4 inputs as mentioned above. Sale no, sale date and broker along with this i have the relevant csv file to be uploaded on to the db… i need the records populated.

For eg the user inputs the following:
Sale no: 32
Sale date: 15/08/2022
Broker: Seller A
File: Sale 32A.csv

Clicks submit.

Assume file has 3 columns Name, age, gender and two rows of data

I need the final data in the db to be as follows

Sale no | sale date | broker | Name | age | gender
32 | 15/08/2022 | Seller A | Tom | 23 | Male
32 | 15/08/2022 | Seller A | Jane | 27 | Female

Currently i am unable to link the form text inputs with the uploaded csv columns

Schedule a workflow on a list is the solution you are looking for next as shown below:

First create a backend API workflow. You should add a Manual Definition parameter of “person” and type of your Data Type you are saving / uploading from CSV.

In that workflow you are going to want to have one step which is “Make changes to a thing…” The thing you are going to change is the person defined in the previous screen (the person passed into this workflow). This is where you are setting your additional data columns.

Finally, connect this workflow with your CSV data uploaded in the next action. Here you will “Schedule API Workflow on a list”. The list is the result of step 1 (which is your uploaded data) and you are going to pass in “This Person” which is a reference to the list above defined by List to run on…

This seems to work partially for me Unable to select data from inputs when creating the additional fields. Help please! Is there a way to connect via call to get a better understanding?

Fair enough, I figured you might piece together the details but I probably should have just connected the remaining dots. When moving between a page workflow and a backend workflow you must pass all of the data you are going to need from the page workflow to the backend workflow via additional parameters.

On the page workflow you will be able to get data from the inputs. See below:

datafield1 and datafield2 are now available in the “Make changes to a thing…” because they are passed in via workflow parameters:

Workflow additional parameters:

Workflow additional parameters on the “Schedule API Workflow on a list…”

Example of passing inputs from the page (ddlDay/ddlMonth/ddlYear) into the API workflow parameters defined above.

This connects all of the dots. If this doesn’t make sense to you I would suggest reviewing the documentation further or watching a few videos on Bubble workflows.

Do you know if uploading as a CSV can search the Primary field to link up with a data type instead of Unique ID?

I just tried it and it didn’t work, but is that something that should be working? If not can you add it to a suggestion list?

When creating a CSV file it’s a little unintuitive for an end user to be putting a long Unique ID in instead of a premade “shortcode” to reference a specific thing.