A Python library for converting files between different formats
Project description
🧙♂️ FileWitch
FileWitch is a versatile Python command-line tool that empowers you to convert files between various formats effortlessly. Whether you're dealing with CSV, Excel, Word, PDF, or plain text files, FileWitch has got you covered.
✨ Features
- 🔄 Bidirectional Conversion: Seamlessly convert between:
- CSV ↔️ Excel (
.csv↔️.xlsx) - Text ↔️ Word (
.txt↔️.docx) - Text → PDF (
.txt→.pdf) - Word → PDF (
.docx→.pdf) - PowerPoint → Word (
.pptx→.docx) - PowerPoint → PDF (
.pptx→.pdf)
- CSV ↔️ Excel (
- 📁 File Duplication: Copy files within the same format
- 🛠️ Simple CLI Interface: Perform conversions with straightforward commands
- 🖼️ Image Support: Preserve images during conversions
- 📝 Format Preservation: Maintain formatting in DOCX and PDF conversions
- 📊 Complex Elements: Handle tables, lists, and other complex elements
🚀 Installation
Ensure you have Python 3.7 or higher installed. Then, install FileWitch using pip:
pip install filewitch
🧪 Usage
🔧 Command-Line Interface
Perform file conversions directly from your terminal:
# Convert CSV to Excel
filewitch convert data.csv xlsx
# Convert Excel to CSV
filewitch convert data.xlsx csv
# Convert Text to Word
filewitch convert notes.txt docx
# Convert Word to Text
filewitch convert report.docx txt
# Convert Text to PDF
filewitch convert notes.txt pdf
# Convert Word to PDF
filewitch convert report.docx pdf
# Convert PowerPoint to Word
filewitch convert presentation.pptx docx
# Convert PowerPoint to PDF
filewitch convert presentation.pptx pdf
# Copy a file within the same format
filewitch convert document.txt txt
🧠 Python API
Integrate FileWitch into your Python projects:
from filewitch import (
csv_to_xlsx,
xlsx_to_csv,
txt_to_docx,
docx_to_txt,
txt_to_pdf,
docx_to_pdf,
pptx_to_docx,
pptx_to_pdf
)
# Convert CSV to Excel
csv_to_xlsx('input.csv', 'output.xlsx')
# Convert Excel to CSV
xlsx_to_csv('input.xlsx', 'output.csv')
# Convert Text to Word
txt_to_docx('input.txt', 'output.docx')
# Convert Word to Text
docx_to_txt('input.docx', 'output.txt')
# Convert Text to PDF
txt_to_pdf('input.txt', 'output.pdf')
# Convert Word to PDF
docx_to_pdf('input.docx', 'output.pdf')
# Convert PowerPoint to Word
pptx_to_docx('input.pptx', 'output.docx')
# Convert PowerPoint to PDF
pptx_to_pdf('input.pptx', 'output.pdf')
📂 Supported Conversions
| Source Format | Target Format | Description | Features Preserved |
|---|---|---|---|
.csv |
.xlsx |
CSV to Excel | Data formatting |
.xlsx |
.csv |
Excel to CSV | Data structure |
.txt |
.docx |
Text to Word | Headings, formatting |
.docx |
.txt |
Word to Text | Text content, image placeholders |
.txt |
.pdf |
Text to PDF | Text formatting |
.docx |
.pdf |
Word to PDF | Formatting, images |
.pptx |
.docx |
PowerPoint to Word | Text, images, formatting |
.pptx |
.pdf |
PowerPoint to PDF | Slides, images, formatting |
.txt |
.txt |
Copy Text file | All content |
.csv |
.csv |
Copy CSV file | All data |
.xlsx |
.xlsx |
Copy Excel file | All data and formatting |
.docx |
.docx |
Copy Word file | All content and formatting |
.pdf |
.pdf |
Copy PDF file | All content |
.pptx |
.pptx |
Copy PowerPoint file | All content |
⚙️ Dependencies
FileWitch leverages the following Python libraries:
pandas: For CSV and Excel operationsopenpyxl: For Excel file manipulationpython-docx: For Word document handlingpython-pptx: For PowerPoint file handlingreportlab: For PDF generationclick: For command-line interfacePillow: For image processingdocx2pdf: For high-quality DOCX to PDF conversionpptx2pdf: For high-quality PPTX to PDF conversion
🤝 Contributing
Contributions are welcome! To contribute:
- Fork the repository
- Create a new branch:
git checkout -b feature-name - Make your changes and commit them:
git commit -m 'Add new feature' - Push to the branch:
git push origin feature-name - Open a pull request
📄 License
This project is licensed under the MIT License.
👨💻 Author
- Raktim Kalita - GitHub
- Email: raktimkalita.ai@gmail.com
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file filewitch-0.2.1.tar.gz.
File metadata
- Download URL: filewitch-0.2.1.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8869ef4f00ea45cc09c2cc3e7ab765761ca1ce8904a7e91534d1fb84e8c4ebf7
|
|
| MD5 |
e33e62166ecf80e6253492578ab9d55c
|
|
| BLAKE2b-256 |
08527d0dcc8e238906376b5d3875ff6b3ec8601b7728f6ffbe79238972c052ec
|
File details
Details for the file filewitch-0.2.1-py3-none-any.whl.
File metadata
- Download URL: filewitch-0.2.1-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50ed25f4c43ffea4064ec0efecd5586c43c59f71b87f95a4278490fc55e6c05a
|
|
| MD5 |
4474d6172ab174ac2f0ac6de646ec11d
|
|
| BLAKE2b-256 |
7c143dfb9a9eb41bde3b12a1079ece11e8d55f6145fddd7d1052387950c18321
|