Skip to main content
These recipes build on the core file API described in Overview and use the libraries listed in Available Packages. Each example runs in an Opus Code task, where Opus.file.create, Opus.file.download, and Opus.file.upload give you everything you need to read, transform, and produce files.

CSV Files

Create a simple CSV from scratch:
Build a CSV with DictWriter:
Read and filter a downloaded CSV:
Download a CSV, filter rows, and upload as a new file:

XML Files

Create an XML file from scratch:
Parse a downloaded XML file:
Download an XML, modify it, and re-upload:

XLS & XLSX Files

Use openpyxl to read and write XLSX spreadsheets. Create an XLSX from scratch:
Read and filter a downloaded XLSX:
Download an XLSX, modify it, and re-upload:
Convert a downloaded XLSX to CSV:

PDF Files

Three PDF libraries are available: fitz (PyMuPDF), fpdf2, and PyPDF2.

PyMuPDF (fitz)

Create a PDF from scratch:
Extract text from a downloaded PDF:
Extract text from a specific page range:
Download a PDF, add a watermark, and re-upload:
Extract images from a PDF and upload each as PNG:
Convert each page of a PDF to a PNG image:

PyPDF2

Merge multiple downloaded PDFs into one:
Extract specific pages from a PDF:
Rotate pages in a PDF:

DOCX Files

Use python-docx to read and write Word documents. Create a DOCX from scratch:
Read text from a downloaded DOCX:
Read tables from a downloaded DOCX:
Download a DOCX, modify it, and re-upload:

PPTX Files

Use python-pptx to read and modify PowerPoint presentations.
PPTX is not a supported file type for Opus.file.create. You can download existing PPTX files, modify them, and re-upload.
Read text from all slides of a downloaded PPTX:
Download a PPTX, add a slide, and re-upload:
Download a PPTX and replace text across all slides:

Overview

Learn the core file API: create, download, and upload.

Available Packages

See every Python library you can import in Opus Code.

Opus Code

Run these recipes in a Python task inside your workflow.