How to add data from external csv to existing table?

Let’s say I have a table in Coda already called “Products”.

Column Names = Product Name, Cost, Color

I have a separate csv file with columns = Product Name, Color, Quantity

How can I efficiently add Quantity to the existing Coda table?

My real world use case has 1000s of rows, so I can’t just manually add it.

I have an idea, but need more info first.

  • When you say 1,000s how many specifically are you talking about?
  • Is this a one time action needed or something that would happen on consistent basis?
  • Your products are already in coda correct? So you just want to MATCH the quantity from a CSV file to the correct product row in Coda and update that quantity field correct?

Specifically 1423 rows and yes all products are already in Coda.

It’s a one time action…for now. It depends on if I can do so easily.

I know that I could use a vlookup function by just copying the coda table into excel, deleting the existing coda table, then reuploading the excel sheet…

But I’d like to not break my doc in the meantime.

Hey Nick!

Heres a quick video to explain how you can do it → Loom | Free Screen & Video Recording Software

And heres an example doc as proof of concept. Let me know if you need any more help! It should be good for 1,000+ rows though I haven’t tried. As long as all your text fits into the cell it should be fine.

I’ve done a similar action on 1,146 rows with 4 columns each. If you only have 2 columns (quantity and product) my solution should handle it just fine.

2 Likes

Thanks Scott!

Copied this over to my personal doc. Should come in handy!

1 Like

Hi @Scott_Collier-Weir,

any chance this is possible to do if there are duplicate values in the tree column, with different trails?

So, effectively tree-trail becomes the unique key that needs to be filtered against.

Yeah should be possible - Havent tried it but essentially follow this logic/idea:

Change the formula in your button to locate the trail rather than the tree (in this example, the trail is in position 2, so nth(2) would locate the trail)

THEN you would filter the base table for trail rather than tree

You could also accomplish this task with a helper table where each value is a row on a unique table and then there is a button row that updates your table as well. I just like this CSV method a little more

The thing is, though I need to target a row that has a unique Trail and Tree combination.

I can have multiple of the same trail or trees in the table, but never will the same trail-tree combination appear twice.

From what I’ve tried, there does not seem to be an intuitive way to add multiple values into the first argument of the withname func. You have to pick one or the other.

What I will try doing is adding a new (hidden) column that concatenates trail-tree into one value.

I get it.

Could you just do a baseTable.filter(tree=currentvalue.nth(1) *and* trail=currentvalue.nth(2))

That should locate unique combinations