How to update records via csv

Hi all,

I wonder if it is possible to update some records via csv?
I exported the records and the id field looks like this (in excel)
image

so when I made my changes and imported them, it would create the records not update them!

any ideas why!!

Does changing the column type to a string/text fix the generated CSV?
We’ve had quite a few issues with excel (and alike) and changing column types usually fixed the issue.

@tjerman the id field is the recordID, I think. because I don’t have a column called id in my module also some of the numbers in the middle are similar to the recordID.

I’m not sure how to change the column’s type in Excel !

will try opening the CSV file in a text editor instead … and see how it goes

Yes, id would be recordID; unsure why I decided to name it as such, apologies for confusion.

Haven’t used Excel in ages but I think it is the same as with Google Sheets – there should be something in the ones of formats/data formatting.

I usually edit all CSV files in VSCode (or similar editors) so I don’t have to deal with this.

1 Like

I am attempting to update some existing records via CSV import to the module.

When I export from the module, the recordID is automatically included as ‘id’ in the resulting CSV. However, when I use that export spreadsheet as a template to make my edits, then import it, there is no way to map the ‘id’ column to recordID during the import process.

No recordID module field available:

Import function disabled when ‘id’ file column is selected:

If I attempt to import without ‘id’, a new record is created; this is not desired.

Desired functionality is to export data from the module in CSV format, make changes in Excel or Google Sheets, save the file, then import the edited file to have the changes made to the database (this is how SalesForce works, by the way, and is probably a function that you want to include if Corteza is to be competitive). If I’m missing something, please let me know.

Seems to be a bug since what you described used to work. Maybe someone removed the system fields from the dropdown by mistake…

If someone could look into that, it would be much appreciated. This is a critical function for ease of updating records.

Yup, its being resolved as part of this issue.

OK, I tried a simple one: updating records using the ID field and one text field. I had no problem importing this data originally, but now I’m getting the following error:

Here’s what the data looks like:

Any idea what’s going on?

Im guessing your positionFqName is either an expression field or used in one.
The expression I’m guessing is invalid, therefore you get this error.

I replicated this by defining a bad field expression and importing data, resulting in the same error.
Check your field configuration.

Getting rid of the field expression in the module solved the problem.

One observation, and it’s a doozy: you have to include ALL of the data for each record when you update it via CSV import. If you try to upload only the ID number and the field that you want to update, Corteza will interpret this as nulling all the other fields in the record. :anguished:

In the future, you may want to modify the CSV update function to ignore any fields not included in the CSV file, and make changes only to the included fields.