-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSONL input #109
Comments
I hadn't thought of this before. Maybe you could post a motivating example here, with a small template and a very small database? I'm having trouble understanding the problem with tables you mention above. |
Oops, sorry! I mean a template like this:
...with a data source as follows we'll have two e-mails generated, each containing a two-row table: {"to_address": "[email protected]", "name": "Nickolay1", "values": [{"id":5, "name_old": "Foo", "name_new": "Bar"}, {"id": 7, "name_old": "Baz", "name_new": "Baz" }]}
{"to_address": "[email protected]", "name": "Nickolay2", "values": [{"id":9, "name_old": "Qux", "name_new": "Bar"}, {"id": 7, "name_old": "Baz", "name_new": "Baz" }]} With a CSV datasource the input to the template can only be a fixed number of text parameters (one for each CSV column). So I have to either provide the table's prerendered HTML in the CSV or use a more complex format, hence the JSON(L) idea. |
I can see this being helpful in a case where different recipients will have different numbers of values filled in. A table, like you said, is a good motivating example. Testing would be important. Here are some things off the top of my head.
|
mailmerge currently reads CSV files as data source.
For more complex templates, for instance containing one or more tables, a more appropriate format seems to be JSON, or, more specifically, json lines, which can be generated by some databases natively (see e.g. FOR JSON AUTO in MS SQL)
I have preliminary implementation in my branch: nickolay@02efaf2
The text was updated successfully, but these errors were encountered: