# doc2docx
[](https://pypi.org/project/doc2docx/)
Convert `doc` to `docx` on Windows or macOS directly using Microsoft Word (**must be installed**).
On Windows, this is implemented via [`win32com`](https://pypi.org/project/pywin32/) while on macOS this is implemented via [JXA](https://github.com/JXA-Cookbook/JXA-Cookbook) (Javascript for Automation, aka AppleScript in JS).
## Install
Via brew:
```
brew install cosmojg/tap/doc2docx
```
Via [pipx](https://pipxproject.github.io/pipx/):
```
pipx install doc2docx
```
Via pip:
```
pip install doc2docx
```
## CLI
```
usage: doc2docx [-h] [--keep-active] [--version] input [output]
Example Usage:
Convert single doc file in-place from myfile.doc to myfile.docx:
doc2docx myfile.doc
Batch convert doc folder in-place. Output docx files will go in the same folder:
doc2docx myfolder/
Convert single doc file with explicit output filepath:
doc2docx input.doc output.docx
Convert single doc file and output to a different explicit folder:
doc2docx input.doc output_dir/
Batch convert doc folder. Output docx files will go to a different explicit folder:
doc2docx input_dir/ output_dir/
positional arguments:
input input file or folder. batch converts entire folder or convert
single file
output output file or folder
optional arguments:
-h, --help show this help message and exit
--keep-active prevent closing word after conversion
--version display version and exit
```
## Library
```python
from doc2docx import convert
convert("input.doc")
convert("input.doc", "output.docx")
convert("my_doc_folder/")
```
See CLI docs above (or in `doc2docx --help`) for all the different invocations. It is the same for the CLI and python library.
## Jupyter Notebook
If you are using this in the context of jupyter notebook, you will need `ipywidgets` for the tqdm progress bar to render properly.
```
pip install ipywidgets
jupyter nbextension enable --py widgetsnbextension
```
## Acknowledgements
Many thanks to [@AlJohri](https://github.com/AlJohri) for the excellent
[docx2pdf](https://github.com/AlJohri/docx2pdf) upon which this is based!
Raw data
{
"_id": null,
"home_page": "https://github.com/cosmojg/doc2docx",
"name": "doc2docx",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9,<4.0",
"maintainer_email": "",
"keywords": "",
"author": "Cosmo",
"author_email": "cosmo@cosmo.red",
"download_url": "https://files.pythonhosted.org/packages/dc/2f/86f311a31cb437a2bee53bf8ec19c1ed513a8b65192972c73076335aa487/doc2docx-0.2.4.tar.gz",
"platform": null,
"description": "# doc2docx\n\n[](https://pypi.org/project/doc2docx/)\n\nConvert `doc` to `docx` on Windows or macOS directly using Microsoft Word (**must be installed**).\n\nOn Windows, this is implemented via [`win32com`](https://pypi.org/project/pywin32/) while on macOS this is implemented via [JXA](https://github.com/JXA-Cookbook/JXA-Cookbook) (Javascript for Automation, aka AppleScript in JS).\n\n## Install\n\nVia brew:\n\n```\nbrew install cosmojg/tap/doc2docx\n```\n\nVia [pipx](https://pipxproject.github.io/pipx/):\n\n```\npipx install doc2docx\n```\n\nVia pip:\n\n```\npip install doc2docx\n```\n\n## CLI\n\n```\nusage: doc2docx [-h] [--keep-active] [--version] input [output]\n\nExample Usage:\n\nConvert single doc file in-place from myfile.doc to myfile.docx:\n doc2docx myfile.doc\n\nBatch convert doc folder in-place. Output docx files will go in the same folder:\n doc2docx myfolder/\n\nConvert single doc file with explicit output filepath:\n doc2docx input.doc output.docx\n\nConvert single doc file and output to a different explicit folder:\n doc2docx input.doc output_dir/\n\nBatch convert doc folder. Output docx files will go to a different explicit folder:\n doc2docx input_dir/ output_dir/\n\npositional arguments:\n input input file or folder. batch converts entire folder or convert\n single file\n output output file or folder\n\noptional arguments:\n -h, --help show this help message and exit\n --keep-active prevent closing word after conversion\n --version display version and exit\n```\n\n## Library\n\n```python\nfrom doc2docx import convert\n\nconvert(\"input.doc\")\nconvert(\"input.doc\", \"output.docx\")\nconvert(\"my_doc_folder/\")\n```\n\nSee CLI docs above (or in `doc2docx --help`) for all the different invocations. It is the same for the CLI and python library.\n\n## Jupyter Notebook\n\nIf you are using this in the context of jupyter notebook, you will need `ipywidgets` for the tqdm progress bar to render properly.\n\n```\npip install ipywidgets\njupyter nbextension enable --py widgetsnbextension\n```\n\n## Acknowledgements\n\nMany thanks to [@AlJohri](https://github.com/AlJohri) for the excellent\n[docx2pdf](https://github.com/AlJohri/docx2pdf) upon which this is based!\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Convert doc to docx on Windows or macOS directly using Microsoft Word (must be installed).",
"version": "0.2.4",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9022f4d841443a5b0d7de23514419a559bf91f7c5f9bdbb0cdcedf414637525d",
"md5": "9ccd666d5bbd982cc79c238d02d0dac3",
"sha256": "cd9b60612ddb4c12383189ee85010a3791bb3056e6ea8bc29fceb2714279f738"
},
"downloads": -1,
"filename": "doc2docx-0.2.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9ccd666d5bbd982cc79c238d02d0dac3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9,<4.0",
"size": 6760,
"upload_time": "2023-04-06T05:46:18",
"upload_time_iso_8601": "2023-04-06T05:46:18.301945Z",
"url": "https://files.pythonhosted.org/packages/90/22/f4d841443a5b0d7de23514419a559bf91f7c5f9bdbb0cdcedf414637525d/doc2docx-0.2.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "dc2f86f311a31cb437a2bee53bf8ec19c1ed513a8b65192972c73076335aa487",
"md5": "2fe56d5d7e7af8457e522221d1c93389",
"sha256": "3a645892549f9e814a3b938d580a1e391e0d557980b5a0ad5e9574071bb5feae"
},
"downloads": -1,
"filename": "doc2docx-0.2.4.tar.gz",
"has_sig": false,
"md5_digest": "2fe56d5d7e7af8457e522221d1c93389",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9,<4.0",
"size": 5905,
"upload_time": "2023-04-06T05:46:19",
"upload_time_iso_8601": "2023-04-06T05:46:19.970326Z",
"url": "https://files.pythonhosted.org/packages/dc/2f/86f311a31cb437a2bee53bf8ec19c1ed513a8b65192972c73076335aa487/doc2docx-0.2.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-06 05:46:19",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "cosmojg",
"github_project": "doc2docx",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "appscript",
"specs": [
[
"==",
"1.2.2"
]
]
},
{
"name": "colorama",
"specs": [
[
"==",
"0.4.6"
]
]
},
{
"name": "lxml",
"specs": [
[
"==",
"4.9.2"
]
]
},
{
"name": "pywin32",
"specs": [
[
"==",
"305"
]
]
},
{
"name": "tqdm",
"specs": [
[
"==",
"4.65.0"
]
]
}
],
"lcname": "doc2docx"
}