CSV Upload (by user)

Hi,
I’ve been trying to let my users upload a CSV with a list of employee names and emails, so that these can be added in bulk to an internal Campaign of theirs.

My data table is very simple at the moment.
Table name: CampaignEmployees
Fields:"

  • Campaign (links to another table called Campaign)
  • EmployeeName (text)
  • EmployeeEmail (text)

Setting:
The user is in their campaign page and only sees the list of CampaignEmployees uploaded for that specific Campaign.
There is a button there for them to download the CSV of that list and a button there for them to upload a CSV to add to that list.
I managed to have Bubble export the CSV of this list with only the CampaignEmployees registered for that Campaign.
However, I cannot make bubble.is upload the CSV when the Campaign column header is in the CSV.
The error I receive in the uploading process is: “This type of field is not supported by the upload CSV action: custom.campaign”

What I have tried:
I took the exact same file that I downloaded by using the csv download button, edited/added lines in the CSV in Excel preserving the same headers and tried to upload it. It doesn’t work. It only works when I remove the Campaign column.
The problem with it is that I cannot allow my users to upload CampaignEmployees without associating those with a campaign.
I also cannot upload these to a temporary table and then run a workflow to convert those into CampaignEmployees because there will be users of different organisations in the app and if they do it concurrently, it will be messed up.

Any idea on how to solve this one?

(I have the feature of adding one by one but this would take ages for the user if the campaign has hundreds of employees.)

Thanks!

It must work with Excel too, but maybe your are not selecting the good separator tab (, ; tab) ? I remember some Excel files was not working, so it’s about format.

I managed to make it work after a break.

@JohnMark, the problem was not with Excel. I was able to open and edit the CSV normally with Excel, Notepad, etc. The problem was when I used the upload function in Bubble and the system tried to match the Campaign text field in my CSV to the Campaign db-reference field in the Bubble database.

But I found a workaround.
I created another field in my CampaignEmployees table called UploadedCampaignID (text)
So, when my user uploads the list of employees, they upload the campaign ID to that text field instead.
I added an extra step as a large popup showing the list of uploaded employees and asking the user to confirm. Upon that confirmation, I run a workflow to link those new uploaded employees to the actual campaign by using that new UploadedCampaignID field.
It actually worked better like this as I can use that confirmation screen to check for upload errors (missing names, wrongly formatted emails, duplicate emails, etc. and only allow the user to commit if those are clear.

But thanks for the reply.
Cheers,

5 Likes

Hey mate, how dare you doing? How did you map the columns headers in the CSV file to the fields in your data type/database? From the Dev side, this is pretty straightforward but, as it is your case as well, I need this to be a customer-facing feature.

What I am trying to do is exactly what you did: user select and upload a CSV, info in the CSV goes to a type’s database.

Do you mind sharing how did you do it? =)

Thanks in advance!

JP

Hi @fonseca.jpp,
As far as I know, for CSV uploads by users, the first line in the CSV (column headers) must match exactly with the field names in Bubble (there is no way of mapping).
So, I created a template CSV file that I make available to my users and ask them to download it first and use it for all uploads.
I ask them not to change the first line at all and just copy the data under it accordingly.
As I mentioned, in my last post, I have implemented a data confirmation popup that shows the uploaded data before the users commit to it. So, if the upload failed, the popup will show that the upload failed/contained no data and reaffirm they need to use the template CSV and not change the first column at all.

1 Like

Hello RScestari:
It is possible to share the workflow? Thanks

Do you get reliable results or does it break from time to time?