CSV upload not importing all fields

Hi guys,

I’m trying to upload a CSV to my database. One of the fields I am uploading is of type “User” and contains an email address. I have found that when I upload the CSV, it does not import this field into existing listings. WOuld anybody have any idea why this happens?



A user in Bubble language is an object, not an email address. I believe you’ll need the unique identifier of the user “thing” from the bubble DB

Thanks so much for the advice!

The CSV upload screen requires the CSV data to be mapped to a specific user field though, and “Unique ID” is not an option??

@andrewgassen was mostly correct: you have an email address (a TEXT, not a User). However you cannot create or change a unique ID of course. Those are created for every thing of any type in your DB. (They are immutable, though they can be destroyed, by deleting the data object with that uid.)

Whatever it is you’re uploading, you’ll need to just upload that and then run a workflow on it (either using the Bulk button/feature or similar in an admin interface of your own design).

Though an email address is not a User, you can of course locate a User object by email address.

You don’t say what the data you are uploading represents, but let’s say it’s like this:

You have a spreadsheet that has information on the pets cared for by your users. Each row represents a pet. Columns are Species, Pet Name and User Email. So it’s like:

** Species | Pet Name | User Email**

All of those fields are texts. (Suppose we had the age of the pet or its birthdate, those would be a number and date, respectively).

Let’s say that ultimately what you want is to create new things of type Pet (described by a Species and Name) and associate each one with the respective user (represented by User Email) as an entry on that user’s list of Pets (a field of type Pet that is a list).

Further, Species itself is not simply a text, but it’s actually a data type itself. (A data type that has one field, Name. This is again analogous to your situation of having a text that represents a User, but is not itself a User object, see?)

So, none of the data we have in the CSV describes, simply and purely, the objects we ultimately want to create or modify. So we must transform the results of our CSV upload into what we DO want.

How to approach this? First, in this case, the things created by the upload are of some intermediate type. Second, we can think of them as temporary.

What you’d want to do on CSV upload is create objects of data type “Temp User Pets” or similar.

Once the upload is complete you run a workflow on the list of all Temp User Pets that:

0… Takes an object of type Temp User Pet as its argument (we could call that key “InputPet” for purposes of the workflow).

  1. Makes a new Species if there is not already any Species where Name = InputPet’s Species.

  2. Makes a new Pet (with Name = InputPet’s Name, Species = Do a search for Species where Name = InputPet’s Species:first item).

  3. Takes the results of step 2 (the newly-created Pet) and pushes it on to the User’s list of Pets. (Make changes to a thing of type User. Which User? Do a search for Users where Email = InputPet’s User Email :first item. Field to change: Pets add item Results of step 2).

  4. Being done with this temporary object, we could delete it. Delete a thing of type Temp User Pet. Which one? InputPet.

Once that workflow is created (this would be created in the “API Workflow” Page as it’s a server-side workflow, not a workflow we run in a page), we can run it either in our app (calling it via schedule API Workflow on a list where the list is Do a search for Temp User Pets) or, the easier way: go to App Data Tab, look at entry for All Temp User Pets and hit the Bulk button to execute that workflow on the objects.

Thanks so much for all your advice! This is really helpful.

I’ve read through your description a few times and I think I’m actually structuring my database in a different way. I’m sorry for not explaining this better in my original question.

My app is a jobs site where companies can login to add/edit jobs. I only have 2 data types: “users” and “jobs”. Rather than having a field within the User type for “list of jobs”, I instead have a field of type “user” within the “Jobs” type.

When manually adding jobs within Bubble, I can simply type the user’s email address and it pulls up the correct user. I was hoping that the same would be true for uploading a CSV. The screenshot below shows the setup for adding a job from within Bubble. If there was a way to upload jobs and have a field which mapped the user correctly, then this would work perfectly. Would there be any way to do this?

Thanks again for all your help!

The field with an email type string here is labeled Company.

Also, I don’t see a User field on Job. But anyway, getting the User object from the User’s email address in a workflow is:

Do a search for Users (where the constraint is Email = the-Email-in-question):first item

So, you have a csv with all the data for a Job, PLUS a field with an email in it representing a User. ADD a field (text type) to your Job type to accommodate that (userEmail or something). Also add a field (User type) called User that you can populate via workflow after upload.

Map the email column to userEmail field in your csv upload configuration. Now your upload CAN create objects of Job type.

The “User” field must then be populated via a workflow. That workflow should take a Job as its argument. The workflow does Make changes to a thing (thing this Job). Change field User to a new value. That new value is Do a search for Users (constraint Email = this Job’s userEmail):first item

In this way, you retrieve an actual User object from an email address. Note that if there is no User object with the given email, the User field on Job will remain empty.

Thanks so much for explaining this. The field labelled “company” is actually the field with type “User”. Sorry, I should have explained that.

But anyway, I’ve read through your example and it makes total sense so I’ll give that a go.

Thanks so much again.

Another possible “shortcut” that occurred to me (not tested). Custom/complex data type things in Bubble can sometimes also be referred to by their unique ID.

So, you might be able to use the User’s unique ID as the value for your User type field in the csv file. (This works in other places such as @mishav’s Toolbox plug-ins, in API Workflow arguments, etc. I’ve just not tested that it works in csv uploads, but would assume so.)

In a sense, this isn’t a shortcut as now it is YOU doing the search for something, but FYI.

It’s unclear to me if your csv upload feature is just for you the administrator or if you intend to extend this capability to your job-posting users. (In the latter case, email address is potentially the more friendly identifier than explaining to users that they need to paste a long uID into that column on their spreadsheet).

Thanks for this suggestion. I had thought of that as well and tried that approach but unfortunately it didn’t work as the Unique ID can’t be mapped upon upload. The CSV upload screen doesn’t allow you to map to Unique ID. It only allows email and other user-added fields.

That’s not how that would work. The mapping is: You have a column “User” that maps to Job’s field of User type.

In your csv, the User column is populated by strings that are the unique ID’s of the User objects in question.

That’s right. It can’t be uploaded though as there is no option to map to unique ID.

So I’ve tried to set this up but it doesn’t seem to be working. I’ve included screenshots below of the setup in case I’m missing something?

In ‘user search for csv upload’
Instead of using key=job type=Job , separate all fields individually.
In your case:

key= ID type=number
key=status type=text

Thanks for this. I tried doing this for each field as suggested but it stopped the "bulk" feature from working. Once more than 1 parameter is added, the API workflow is greyed out in the "Bulk" menu and it has a message saying "more than 1 parameter"

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.