Open davidverweij opened 4 years ago
I'm thinking about that default thing. I guess we can do somthing about it like default naming would be e.g. Document.docx, Document_2.docx and so on.
We just have to put default parameter in function like name="Document"
and the function will do the rest of work
About multiple columns i have to check how click is handling multiple argument for same parameter
And for missing data in CSV we can use default naming scheme e.g. Document.docx, Document_2.docx and so on
Another thing I was thinking about adding more output to command like where the files are saved, is there any missing data in name column etc. So user can know what's going on.
I deleted and merged those comments with your first as it's easier to read 👍 Feel free to edit comments as you have new ideas if no one has responded 🦾
@jawrainey what do you think about my solution should I implement it?
@salmannotkhan, please refrain from implementing at the moment - although I admire your enthusiasm! 👍 Let's first take our time to discuss the pros and cons for each possible implementation (such as your suggestion), and then we'll assign this task to one of the contributors. If you have any thoughts, do share them (as @jawrainey indicates above) here, or in any of the other Issues we set up.
After all, this is a project on-the-side from our full-time occupation, and we intend to keep the pace rather low (not day-by-day changes). And to add to that, there are more collaborators eager to contribute in code! (Including myself and @jawrainey) 🤓
I understand your point but I'm more of coding than discussing person. that's why I'm eager to implement things than discussing them. Pardon my eagerness.
I was thinking what if we give user option to create one docx file that contains all of the mailmerged documents?
That does make for a nice option in the use of the library. Do you think many people would need such an option? I.e. is this a scenario you might have seen people using Word for? Let's keep this option on our 'wish list' - and if we would get requests for this feature we can consider implementing it.
It is most required feature just think about it you have mailmerge 100 documents and you want to print them all. You can't open 100 documents separately and print them one by one. But if all the merged documents are in one docx you just have to click print.
Good point! I honestly didn't think about the scenario that someone would want to print the output. Somehow I was only thinking about digital uses. @salmannotkhan can you please open up an Issue that describes this as a feature request? We can then keep this issue focused on the naming convention. Cheers!
edit - thinking about this a bit more, this would equally be good once we have the export to pdf option. Perhaps the libary can receive a parameter, e.g. 'merge' which will do just that?
My suggestion would be to allow for one or multiple strings (an ordered List) for the .csv header name, plus a 'separator'. Then, instead of throwing an error if the header is not found, any non-found headers are read literally in the naming scheme. One 'concern' I might have with this solution would be that it might be functionality that is hardly used. Example:
# in csv2docx.py
def convert(
data: str,
template: str,
name: Union[str, List[str]], # changed
name_sep: str = "-", # new
path: str = "output",
delimiter: str = ";"
) -> None:
In the click
CLI we can then use the multiple options
parameter to allow for a list of strings
As referred to in my code review of #22, we should have a discussion around what the user expects, and what use cases we envision for the CLI or module. For example, there are a few considerations:
template.docx
and one or multiple .csv headers? I am imagining an invoice, withinvoice.docx
as template, and an output such asinvoice_eventX_david_verweij_March_2020.docx
Next steps
Before implementing any code, I would like to kick off this discussion below. What are your thoughts on these use cases, any use cases you can think of (or have experienced yourself) and to what extent is this something our script should handle (considering OS native solution to batch rename files).