xlwings Lite Local File Access: 8 Patterns You Can Use Today

Published: February 21, 2026

A few weeks ago, Felix Zumstein released local file system access for xlwings Lite. This is a big deal. Until now, xlwings Lite scripts running in the browser had no way to read or write files on your local drive. You could work with data inside Excel, but you could not save a PDF to your desktop or load a CSV from a folder. That limitation is now gone.

I have been experimenting with this feature and compiled 8 useful patterns into a single demo script that you can run end-to-end. The demo uses ODI cricket data and is structured as a 9-step sequential process - the first step simply fetches the sample data so you have something to work with, and the remaining 8 steps each show a distinct local file pattern. You can of course use your own data instead of the demo dataset.

One-Time Setup: Mount Your Local Folder

Before running anything, you need to mount a local folder. This is the only setup required.

  1. Open xlwings Lite and click the hamburger menu (three lines) in the top-left of the xlwings Lite task pane.
  2. Click "Files".
  3. Go to the "Local Folders" tab.
  4. Click "Add Folder" and select the folder on your computer you want to use (for example, a folder on your Desktop).
  5. In the "Path in Python" field, type: xltest22
  6. Click the tick mark button to confirm.
  7. Restart or reload xlwings Lite for the mount to take effect.

Your local folder is now accessible at /xltest22 inside the Python environment. The script reads from and writes to this path.

Getting the Data In

The first step downloads a zip file containing about 6,000 individual cricket CSV files from a GitHub release. Since GitHub release URLs are not CORS-enabled for browser access, the download is proxied through a Cloudflare Worker. The file is saved directly to your mounted local drive. You can skip this step entirely if you already have your own data on the mounted drive.

The 8 Patterns

Pattern 1: Unzip and Process Files on Local Drive The script opens the zip file from the local drive, extracts about 3,000 ball-by-ball CSV files (the zip contains 6,000 files total - half ball-by-ball, half match data), and concatenates them into a single 192 MB CSV. The output is written back to the local drive. Uses Python's built-in zipfile and csv modules to read and write files directly on the mounted drive.

Pattern 2: Convert CSV to Parquet The combined CSV is read using DuckDB and converted to Parquet format, bringing it down from 192 MB to under 5 MB. The Parquet is stored in browser memory as a working file. Uses DuckDB's read_csv_auto and COPY TO commands for format conversion.

Pattern 3: Run Analytics and Create Charts in Excel DuckDB queries the Parquet data to produce Top 15 Batsmen and Top 15 Bowlers summary tables. Matplotlib generates charts for both. Results are written to Excel sheets with formatted tables and embedded chart images. Uses DuckDB for SQL analytics, Matplotlib for charts, and xlwings to write formatted output back to Excel.

Pattern 4: Generate HTML Report to Local Drive Creates a complete HTML report with styled tables and chart images, then writes the HTML file along with chart PNG files to the mounted local drive. You can open the report in your browser directly from your desktop. Uses Pandas to_html for table rendering and standard file I/O for saving.

Pattern 5: Generate PDF Report to Local Drive Creates a 4-page landscape PDF with charts and data tables, saved directly to the local drive. ReportLab is installed on-the-fly via micropip at runtime - no pre-installation needed. Uses ReportLab's platypus layout engine for tables, images, and page formatting.

Pattern 6: Save Parquet File to Local Drive Copies the Parquet file from browser memory to the mounted local drive, persisting it for use outside xlwings Lite. Uses standard Python file I/O (open, read, write) to transfer the file from browser temp storage to the local filesystem.

Pattern 7: Send Email with Local File Attachments Reads the PDF and HTML files from the local drive, base64-encodes them, and sends them as email attachments via the Brevo transactional email API. The recipient is read from an Excel cell, the API key from an environment variable. Uses pyfetch to call the REST API with file attachments.

Pattern 8: Generate PowerPoint to Local Drive Creates a 2-slide widescreen PPTX with charts and styled data tables. python-pptx is installed on-the-fly via micropip. Slide 1 has a batting chart and stats table, Slide 2 has bowling stats and chart. The file is saved to the local drive. Uses python-pptx for slide layout, tables, images, and text formatting.

What This Means

The local file mount changes what xlwings Lite can do. Before this, everything was confined to the browser and the Excel workbook. Now you can download files from the internet to your drive, process data using your local filesystem as working storage, and generate output files - PDFs, HTML reports, PowerPoint decks, Parquet files - that land right on your desktop.

All of this runs in the browser using Pyodide. No local Python installation needed. The script covers patterns that most data workflows would need. Pick and adapt whichever patterns are relevant to your use case.

Resources

xlwings Lite official site: lite.xlwings.org