Mail merge to PDF in Coda

Not sure if this is possible or would require a Pack that doesn’t exist yet. Trying to replace a MS Excel/Word based invoicing workflow with a Coda one. Right now the best I can think of is creating an invoice as a detail view in Coda, then manually downloading each record as a PDF. Is there some way of doing this in Coda without the painstaking manual download process?

3 Likes

I have discovered the answer to this is no. The quickest way I can find to do it in Coda is to create a detail view page as a sub-page, and duplicate it as many times as you need invoices. Then go to each sub-page and select the record you want the invoice for. When done, go to the page that holds those sub-pages, and export PDF for “pages + subpages”.

The issues with this approach are:

  • It’s slow
  • Sometimes Coda forgets what you selected and goes to the top record in the detail view
  • If you have more than 10-15 sub-pages to print, Coda may say no dice
  • In exported PDFs the expansion arrows are visible, so you have to manually remove them

In short, I don’t recommend Coda for this right now unless you’re working with a small volume of invoices or just really into using Coda for everything.

2 Likes

Hah was just talking with some folks about this (how it would make a nice Pack).

I have a similar use case where I need to prepare nice PDF call sheets for shoots - I have a template that I then “mail merge” the data for a particular shoot into. The best solution I have today is to use Google Apps Script (I since migrated to a Google Cloud Function, but same thing fundamentally) to pull in data from Coda via the API and populate my HTML template. Here’s an example:

Happy to chat more if you’re interested.

Taking things a step further, @Xyzor_Max was able to get HTML embedded back into Coda too.

Some other Pack Makers warned me against digging too deep into PDF land, which I think is wise (better to print HTML to PDF)… I also wondered if there was some kind of third party document service with an API that could be Packified…

Anyway, all of this to say, I’m interested in this too and think it would be super helpful. Basically, the same way Coda can create published docs, or in the extreme, be used as a CMS for another frontend, it would be cool if it could populate templated layouts of some kind.

Edit: maybe this? https://craftmypdf.com/

2 Likes

this one I came across recently: DocSpring | Fill out PDF forms with an API request
it is not cheap and looks like the one you mentioned.

since everything in terms of data lives already in Coda, I actually would love to see a native solution, but that requires that Coda improves the actual pdf generation and print functions first.
cheers, Christiaan

2 Likes

forgive me if i misunderstand your requirement.

but i have done this kind of thing inside coda without a pack.

in our case we just needed to generate a HTML version of the invoice.

we do that by having a Canvas-Column in our table. it builds the rich-text version of the invoice formulaicly.

it is initialized using a template stored as a canvas-column elsewhere but has the thisRow and parentRow formulas needed to populate the invoice once it is added to the row.

there is then a ToHtml() button that grabs the HTML for the page, and that is used to send the invoice.

the ToHtml() function does a so-so job of rendering a page as HTML (there is no CSS formatting) but its good enough.

@Paul_Danyliuk has posted an HTML invoice rendering solution that uses a feature of the Image() function using an SVG encoding that encapsulates HTML - which might be useful also. this solution supports more advanced HTML and CSS encoding.

i suspect this is a low-hanging paid pack opportunity, as it is a VERY common requirement in business workflows (hint-hint to all you packineers out there!)

max

4 Likes