Skip to main content

🧙‍♂️ 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)
  • 📁 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 operations
  • openpyxl: For Excel file manipulation
  • python-docx: For Word document handling
  • python-pptx: For PowerPoint file handling
  • reportlab: For PDF generation
  • click: For command-line interface
  • Pillow: For image processing
  • docx2pdf: For high-quality DOCX to PDF conversion
  • pptx2pdf: For high-quality PPTX to PDF conversion

🤝 Contributing

Contributions are welcome! To contribute:

  1. Fork the repository
  2. Create a new branch: git checkout -b feature-name
  3. Make your changes and commit them: git commit -m 'Add new feature'
  4. Push to the branch: git push origin feature-name
  5. Open a pull request

📄 License

This project is licensed under the MIT License.

👨‍💻 Author

Metadata

Release files for filewitch 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for filewitch 0.2.1
File Size Uploaded
filewitch-0.2.1.tar.gz 7.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for filewitch 0.2.1
File Interpreter ABI Platform
filewitch-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 16.0 kB

Release files / filewitch-0.2.1.tar.gz

Download URL filewitch-0.2.1.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
8869ef4f00ea45cc09c2cc3e7ab765761ca1ce8904a7e91534d1fb84e8c4ebf7
BLAKE2b-256 checksum
How to use checksums
08527d0dcc8e238906376b5d3875ff6b3ec8601b7728f6ffbe79238972c052ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.8

Release files / filewitch-0.2.1-py3-none-any.whl

Download URL filewitch-0.2.1-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
50ed25f4c43ffea4064ec0efecd5586c43c59f71b87f95a4278490fc55e6c05a
BLAKE2b-256 checksum
How to use checksums
7c143dfb9a9eb41bde3b12a1079ece11e8d55f6145fddd7d1052387950c18321
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.8

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page