Drafts markdown to MSWord document

I have made a Shortcut that takes CSV file and takes out the pertinent information and makes a Draft markdown file. Everything works fine. However I would like then to to take that Draft markdown file and export it to a new MSWord document. Can’t seem to find a way to do it. Any ideas? I need it to be an MSWord doc because my work only uses Word.

I was going to suggest feeding the output form “Make Rich Text from Markdown” into “Add to Pages Document”, but Pages seems to have very poor Shortcuts support.

Perhaps using Drafts on its own or as an intermediary would work. There’s a Convert to DOC action that could work. There’s Drafts shortcuts “Run Action with Text” and “Run Action on Draft” but I can’t seem to get any actions to show up in the menu.

The title says “Drafts”, which suggests the app, but then in the text it refers to “Draft Markdown file” a couple of times which suggests it isn’t, on the basis “Draft” becomes “Drafts”, and Drafts does not have Markdown files (all content actually resides in a database, which is how the versioning and meta data are handled).

If you do indeed have a Markdown file of some sort (or simply include a step to export a Markdown file from a draft in Drafts), then I would suggest looking at using Pandoc. Converting a markdown file to a Word document is then a simple command line call, which you could include in a Shortcut, or run from a script step in a Drafts action should you export a Markdown file from Drafts with an action. You can also create a standard doc template so you can match your coportae style by reusing the organisation template for example - which can simlify things.

pandoc -o converted.docx -f markdown -t docx original.md

Everything with the pandoc approach is on device, requiring no cloud services, and is fully automatic - but it is not transferrable to i*OS; though I note the query is listed as for macOS.

The “Convert to Doc” Drafts action requires several manual steps. If you use the “Convert to Doc” action, do ensure you check out the privacy policy and terms of use for online-convert.com (the service it uses) first and take care to note how this may fit with your organisation’s data security requirements.

Hope that’s a useful option to consider.

1 Like

Thanks oldblueday. I tried those various actions in Shortcuts but like you I had no success. This seems a kind of thing MacOS Shortcuts should be able to do easier. Maybe the next major update.

Thanks Sylumer. Pandoc worked great. I save the Drafts file as markdown then convert it from Shortcuts to Word document.
The template idea is a good one. But not sure how to go about this. Should I create the template in Drafts to match my company’s template. Or append the Draft to my worked Word template? My felling is it may be easier just to do the whole template in Drafts and then convert it to Word.
Thanks again for your help.

See the reference-doc pandoc option directly linked below for how to utilise a Word document as a style template.


Ah. I will dig into that.
Thanks again sylumer!

If its a CSV file, why convert to markdown first

If it is some sort of table, might be simpler to open in Numbers or Excel.

It began in an Excel sheet. But what I need to do is take certain lines that pass a threshold and put that into a Word script to be used later. So I send it to Shortcuts that has a Scriptable inline script that takes out all the threshold information and then I format it properly and send it to a Drafts document. I keep adding Execl sheets to that Drafts document till I have all the information I need. Then I use another Shortcut to take the finished document in Drafts and transforms it to a Word document using Pandoc and saves that Word document into my work’s OneDrive.