Data > Modify Upload

When trying to upload a CSV to “modify” a table I get this error message: “You are trying to modify some existing data, but haven’t selected a field for the Unique ID. This is mandatory”

How do I select a field to be the Unique ID? I have selected a field as the “primary field” (via Data > App Data > Primary Field Button). But that didn’t help.? What am I missing?

Hey @john.a.papa,

Welcome to the Bubble community!

Can you send a screenshot of what this looks like?

SureL first i click modify:


Then this:

then i see this:
image

Does the CSV have a unique id column?

1 Like

+1 @cmarchan’s comment. I think that’s the issue.

1 Like

Thanks @johnny and @cmarchan .

The data CSV I am uploading has a unique column of data, however, that column is not titled ‘Unique ID’ It’s titled ‘Entry Id’. I have created a database table of exactily the same column names in Bubble. The plan is the user will upload this data with a CSV export from another system. Rows with a new ‘Entry Id’ to be appended and rows with the same ‘Entry Id’ to be updated. I’m not clear on what constitutes a unique ID in Bubble.

  1. Does the uploading CSV have to have a column labeled Unique ID, or
  2. Does the ‘Entry Id’ need to be mapped to a field in the Bubble database named ‘Entry Id’ or
  3. Does Bubble need me to somehow mark the 'Entry Id’ filed as the Unique ID field?

If you could help me to clarify this that would help me past this hurdle. Thanks a million for taking the time to reply.

Unique ID is the ID automatically created by Bubble to definciate the difference between different records. Thus, it’s mandatory.

Yes.

Entry ID can be another field in your user, but Unique ID is something that’s mandatory that Bubble uses.

1 Like

Thanks, 100% clear now. So my solution will not work unless I export the unique ID, update the CSV and re-import it. This does not work for my app users.

Is there another way to do what is the equivalent of a “traditional update query” where a CSV is imported to update an existing database in bubbe and either updates or appends data based on a primary key? For example, could I upload the full file to a temporary table, then use an internal query in Bubble to update a “master table”, then empty the temp table ready for the next update file? Or do I have to move to an API solution? What is your recomendation?

1 Like

Need this solution as well

You can have your own ID, but the record that it’s stored with has to match its unique id.

Thanks @johnny, I now understand that. The issue is that I don’t hold those IDs externally to Bubble. To do so would mean exporting them first from bubble, then updating the exported CSV file in a separate software and then re-importing them again using the “modify” import. But my app is importing the CSV file from another software’s export process (no API available). That software has its own unique ID for each record that does not change when other fields in that software change. I am importing that unique ID. Later exports from that same software (with changes to the CSV data both in terms of new records and altered records) are then uploaded to Bubble and I am trying not to create duplicate records. I thought there might be an easier way to “update” the bubble DB using this unique ID but sadly no.

From the looks of it, the only solution is to create an API workflow looping through all records and identifying duplicates individually (on the imported unique ID field), and deleting them based on older ‘created by’ dates but this just seems a bit of a long way around, but it’s the only option until bubble introduce functionality to the modify process to utilize another unique ID selected by the user.

Ah… I see your issue. What about trying to import it all on the front end? Using the “Upload CSV” action?

That’s what I’m doing but ending up with duplicate records because the data I’m importing is not static but part of a changing data set. The only thing that does not change is the unique ID. Hope that makes sense…

I had a requirement to add a new field (text) to a data type, then I received an excel sheet with values for this field and I was supposed to update all the data in the data type (290 records) with the value in the excel sheet to be saved to the newly created text field.
I got the same error related to the “unique ID” and what I did to solve the problem and perform the required mass update is as follows:
1 - I exported all the data from Bubble (data tab) including the “unique ID” field (this is very important)
2 - I Merged the exported results with the excel sheet I received.
3 - I sorted all the columns with the same field to ensure that the unique ID is corresponding to the correct record
4 - I did a mass update using the “Modify” button in Bubble data tab

Hope this helps!

Hello. As I understand it, when a new entry is added to the database, Bubble automatically creates a Unique ID for each. In my Google Sheets file, I named one of the columns Unique ID to match it with the Bubble Unique ID on import. I don’t populate this column in the Google Sheets file, it’s empty. When exporting, will Bubble fill it automatically?