In case you missed: 2-way Cross-Doc is here (sorta)

In case you didn’t notice it yourself, Coda cross-doc already supports adding, modifying, and deleting rows in other docs.

This isn’t hidden functionality: it’s in the formula editor hints as well as the docs. However it seems it’s not quite ready for release too: the UI for setting this up without a formula is still incomplete, and the docs leave quite a lot for you to figure out on your own. Hence this topic to clear things up.

Here’s how you add a row into a cross-doc table:

  1. First parameter is the connection. It should have write access to the table you’re going to write to.
  2. Second parameter is the table URL in format {doc URL}#_tu{table ID}. You can get it by e.g. taking a Row object of any row imported through Cross-doc from that table and removing the row ID part:
    image
  3. Next are column name/id and value pairs. It’s better to use column ID and not a name, because otherwise this will break if you change column name eventually. To get column ID first enable Developer Mode (https://coda.io/account -> Labs), then right-click on the column and you’ll see the Copy column ID option there:
    image

Same for ModifyRow and DeleteRow, only that you need to use Row URL (full Row.RowUrl from the row object), and to delete a row you don’t need to list the columns.

Gotchas:

  • It seems there’s a bug that won’t update the source table with the changes until you reload the tab with the source doc. @BenLee would you please log this for engineers to look into? Same happens sometimes with the data updated via API/Zapier too, so I think the problem exists on the API/messaging level.
  • I haven’t found the way to also trigger cross-doc table sync via an action (i.e. to pull the data after pushing the change). Right now you have to either do it manually or wait for the next auto sync.
3 Likes

Another gotcha:

  • Just tested, and actually you need both read-write access to the table you want write to. Simply write access won’t be enough.
  • Also the referenced table must be a table (grid-xxxxxxxxxx), not a view.

So the only way to make a submission form where a user won’t be able to also read all the submissions is to either filter out all rows on the master table, or hide all the columns. Then use views in the source doc to review all the data.

Form demo:

Answers doc:

4 Likes

Thanks a lot! @Paul_Danyliuk in case you want to embed the “coda form” on a website how do you do it? Is there any tips you could share? :slight_smile:

You just press Share and select Embed. Then enable Play mode and probably disable the Sections list. Then copy the code it generates and paste it in your website… or here.

Oh, and the doc must be editable for all, it seems. Otherwise cross-doc actions will not work. So there’s a risk of someone opening it in the separate tab and messing the doc up.