Auto CSV Import

Hey Seth, Ben here from Coda.

This is a pretty common workflow, so I’m glad you asked. Coda has a native CSV import tool and also does well when CSV data is pasted in directly, but a CSV import using a script would be able to handle row redundancy and upsert on existing data.

Google has a great tool to create scripts to connect different services online. I wrote a script here that would handle importing a CSV saved in Google Drive to a Coda doc: https://script.google.com/d/1c-kUejkfLiCIHTj30uiXW_Yl5zefcQkqDGTl-mzGvYZYbPYiFkBPRG4u/edit?usp=sharing

One thing to note is that Google Script relies on the source file being saved on the internet, so for importing CSVs it’s probably easiest to use Google Drive. Drive also means we can utilize Google’s utility library.

You’ll need a few pieces of info to do this, but it’s super easy:

  1. Coda doc ID
  2. Your Coda API key
  3. Google drive folder ID
  4. Target table name
  5. Columns to upsert on

After that, the script handles all the heavy lifting. The script will handle an unlimited number of files in the source folder, but it’ll get slower as that number increases.

To use the script, just make a copy of the script and add your information from 1-5 above.

Coda Community - let me know if you’re doing any interesting workflows that involve automation across disparate online services!

21 Likes