Support for XlsxWriter in Python execution blocks

Support for XlsxWriter in Python execution blocks

My goal

I’m trying to generate a formatted Excel file from a Python block in a Retool Workflow.
The report requires row-level formatting (background colors, bold text, numeric formats), so I need to use xlsxwriter.


Issue

The Python runtime in my Retool workspace does not include xlsxwriter, and I’m unable to add it myself.

When I try to import it, I get:

ModuleNotFoundError: No module named 'xlsxwriter'

In Workspace / Workflow settings, I only see “Python configuration / Setup scripts”, which allows shared imports but does not allow installing new dependencies. I don’t see any option to manage Python dependencies.


Steps I’ve taken to troubleshoot

  • Confirmed I am a workspace admin

  • Verified that xlsxwriter is not available:

    try:
        import xlsxwriter
        ok = True
    except Exception as e:
        ok = str(e)
    
    return {"xlsxwriter": ok}
    
    
  • Confirmed that openpyxl is available:

    {"openpyxl": true}
    
    
  • Confirmed that:

    • pip install does not work in Python blocks

    • Setup scripts do not install dependencies

  • Checked all Workspace and Workflow settings for a Python dependencies section (none visible)


Additional info

  • Deployment: Retool Cloud

  • Using: Workflows → Python blocks

  • I only see Import / Export from JSON in Workspace settings (no Python dependency management UI)

1 Like

Hey @Joan_Cortes

You can use it like this

First add the package into the python:


Click on the add python library

Add the 'xlsxwriter' library into it.
Use it into the python block:

def has_xlsxwriter():
    try:
        import xlsxwriter
        return True
    except ImportError:
        return False

return has_xlsxwriter()

Hope it will also work for you .