Install
openclaw skills install office-editorCreate or modify Word (.docx), Excel (.xlsx), and PowerPoint (.pptx) files. Use when the user mentions Office, Word, Excel, PowerPoint, docx, xlsx, pptx, spreadsheets, presentations, or document export. Check dependencies first, and if a core library is missing, report it directly instead of installing anything automatically.
openclaw skills install office-editorUse this skill for .docx, .xlsx, and .pptx files. Identify the file type first, check the required dependencies next, and then decide whether to create a new file or modify an existing one.
python-docx, Excel uses openpyxl, and PowerPoint uses python-pptx.pip, pip3, python -m pip, sudo, or similar install commands automatically.references/ when an advanced API is needed. Do not load every reference file into context at once.python-docx: for Word documents.openpyxl: for Excel workbooks.python-pptx: for PowerPoint presentations.pandas: only needed when converting between DataFrames and Excel.pillow: only needed when inserting images into Excel.Use a read-only import check like this. If the check fails, stop implementation and report the missing package(s) directly.
import importlib
PACKAGE_MAP = {
"docx": "python-docx",
"openpyxl": "openpyxl",
"pptx": "python-pptx",
"pandas": "pandas",
"PIL": "pillow",
}
missing = []
for module_name, package_name in PACKAGE_MAP.items():
try:
importlib.import_module(module_name)
except ModuleNotFoundError:
missing.append(package_name)
print(missing)
Choose what to check based on the task:
.docx tasks: check docx.xlsx tasks: check openpyxl.pptx tasks: check pptxpandasPILUse python-docx for .docx files.
from docx import Document
document = Document()
document.add_heading("Document Title", level=1)
document.add_paragraph("This is a paragraph.")
document.save("new_doc.docx")
from docx import Document
document = Document("existing_doc.docx")
document.add_paragraph("Appended content")
document.save("updated_doc.docx")
{baseDir}/references/docx_api_summary.md{baseDir}/scripts/create_basic_doc.py{baseDir}/scripts/edit_existing_doc.pyUse openpyxl for .xlsx files.
from openpyxl import Workbook
wb = Workbook()
ws = wb.active
ws.title = "Data"
ws["A1"] = "Hello"
ws.append(["Data 1", "Data 2", "Data 3"])
wb.save("new_workbook.xlsx")
from openpyxl import load_workbook
wb = load_workbook("existing_workbook.xlsx")
ws = wb["Sheet1"]
ws["A1"] = "Updated value"
wb.save("updated_workbook.xlsx")
{baseDir}/scripts/create_basic_workbook.py{baseDir}/references/xlsx_charts.md{baseDir}/references/xlsx_features.md{baseDir}/references/xlsx_pandas.mdUse python-pptx for .pptx files.
from pptx import Presentation
prs = Presentation()
slide = prs.slides.add_slide(prs.slide_layouts[1])
slide.shapes.title.text = "Slide Title"
slide.placeholders[1].text = "This is the content placeholder."
prs.save("new_presentation.pptx")
from pptx import Presentation
prs = Presentation("existing_presentation.pptx")
slide = prs.slides.add_slide(prs.slide_layouts[1])
slide.shapes.title.text = "New Slide"
slide.placeholders[1].text = "Additional content"
prs.save("updated_presentation.pptx")
{baseDir}/references/pptx_api_reference.md{baseDir}/references/pptx_chart_guide.md{baseDir}/scripts/create_presentation.py{baseDir}/scripts/create_basic_doc.py{baseDir}/scripts/edit_existing_doc.py{baseDir}/scripts/create_basic_workbook.py{baseDir}/references/xlsx_charts.md or {baseDir}/references/xlsx_features.md firstpandas is available, then read {baseDir}/references/xlsx_pandas.md{baseDir}/scripts/create_presentation.py{baseDir}/references/pptx_chart_guide.md firstreport.docx, budget.xlsx, or deck.pptx.updated_*.ext to avoid accidental overwrites.