Skip to main content

❓ FAQ

Installation​

Q1: pip install is too slow. What can I do?​

A: Use a mirror to accelerate:

pip install python-office -i https://pypi.tuna.tsinghua.edu.cn/simple

Q2: Installation fails with "Microsoft Visual C++ 14.0 required"​

A: This is a compilation error of certain dependencies. Solution:

python -m pip install --upgrade pip
pip install python-office --only-binary=:all:

Q3: Word to PDF fails on macOS?​

A: You need to install LibreOffice:

brew install --cask libreoffice

Usage​

Q4: ModuleNotFoundError is raised when calling a function?​

A: That function depends on extra libraries. Run pip install python-office[all] to install them all.

Q5: How do I view the full parameter description of a function?​

A: Three ways:

  1. Check the docs: visit Module API Reference
  2. Python built-in: help(office.excel.fake2excel)
  3. IDE hints: typing office.excel.fake2excel( in your IDE will show parameter hints

Q6: Chinese file names are garbled?​

A: Python 3 uses UTF-8 by default, so there should be no issue. For Python 2:

import sys
sys.setdefaultencoding('utf-8')

Q7: When calling WeChat features, it says "Not logged in"?​

A: PyOfficeRobot requires you to log into the WeChat web client first. Scan the QR code to log in and keep the window open.

Q8: Word/PPT to PDF output has messed-up formatting?​

A: Embed fonts in the source document, or install the corresponding Chinese fonts in your system.

Q9: OCR feature returns "API error"?​

A: Baidu OCR API requires you to apply on your own:

  1. Visit Baidu AI Cloud to register
  2. Create a "Text Recognition OCR" application
  3. Get the API Key and Secret Key
  4. Pass them in your code:
    office.ocr.VatInvoiceOCR2Excel(
    input_path='./invoice.jpg',
    id='your_api_key',
    key='your_api_secret'
    )

Advanced​

Q10: Can it be used in multi-threaded / multi-process environments?​

A: Absolutely:

  • File operations: use multi-process
  • Network operations: use threads
  • CPU-bound tasks: use multi-process

Q11: Can it be integrated into a web project?​

A: Yes! python-office is a pure Python library:

from flask import Flask
import office

app = Flask(__name__)

@app.route('/merge_excel')
def merge_excel():
office.excel.merge2excel('./uploads/', 'merged.xlsx')
return 'OK'

Q12: How to contribute to the project?​

A: Contributions are welcome! See the Contributing Guide.

Q13: Report a bug or request a feature?​

A: Submit it on GitHub Issues.

Performance​

Q14: High memory usage when processing large files?​

A: Use generators or batch processing, upgrade to 64-bit Python, and increase system memory.

Q15: How to speed up processing?​

ScenarioOptimization
Excel batchUse merge2excel instead of manual loops
PDF processingDisable antivirus scanning
Image processingParallelize with multiprocessing
Network operationsAdd retry mechanism and timeout settings

Didn't find your answer?​

AI 办公效率课
35 讲 AI 自动化办公实战课用 Python + AI 处理 Excel、Word、PDF、邮件等办公场景。
去学习