Audit, Render, and Convert Excel with MCP

Audit, Render, and Convert Excel

After creating or editing a workbook, check its formulas and presentation before sharing it. The calls below continue the sales report example.

Audit a workbook

{
  "name": "audit_workbook",
  "arguments": {
    "file_path": "sales.xlsx"
  }
}

Review the returned issues, their severity, and coverage. For another page of findings, pass the returned next_cursor as cursor with the same file and sheet scope. Pagination does not resolve partial audit coverage. A sheet-only audit checks stored results without recalculating the whole workbook. Technical audit results do not replace business checks such as reconciling totals against source data.

Choose a plan quality level

quality_level Purpose
integrity Default. Blocks errors in the integrity and calculation categories. Reports data-validation violations without blocking solely on them; no presentation or print checks.
standard Adds presentation and print checks. Blocks all error-severity findings, including enforced data-validation violations; warnings do not block.
strict Runs the same checks as standard and also blocks findings marked delivery_blocking. It does not reject every warning.

Set the level on apply_workbook_plan, not on audit_workbook. A failed quality gate leaves the target unchanged. Existing problems in the source can also block a plan; examine the findings before retrying. Partial required audit coverage blocks publication at every level.

Preview a range or chart

{
  "name": "render_workbook",
  "arguments": {
    "file_path": "sales.xlsx",
    "mode": "range",
    "sheet_name": "Sales",
    "range": "A1:D3"
  }
}

The tool returns an inline PNG. Check text clipping, number formats, widths, and missing glyphs. A range can span multiple pages according to the sheet’s page setup; inspect rendered_range and follow next_page until all requested content has been reviewed.

For a real printed page, use mode: "sheet_page" and page: 1, omitting range. For the chart from the chart guide:

{
  "name": "render_workbook",
  "arguments": {
    "file_path": "sales.xlsx",
    "mode": "chart",
    "sheet_name": "Sales",
    "chart_name": "SalesTotals"
  }
}

Export a PDF

{
  "name": "convert_workbook",
  "arguments": {
    "file_path": "sales.xlsx",
    "output_path": "sales.pdf",
    "sheet_name": "Sales"
  }
}

output_path determines the format. Supported output extensions are .xlsx, .xlsm, .xlsb, .xls, .ods, .csv, .tsv, .pdf, and .html. The output must differ from the input. Omit sheet_name to use the workbook’s PDF export settings, or specify one visible sheet. CSV/TSV export one sheet and require sheet_name when the input contains multiple sheets, including evaluation warning sheets. sheet_name is supported only for PDF, CSV, and TSV output.

To control PDF layout, add this operation to a revision-checked plan before export:

[
  {
    "id": "print-layout",
    "type": "set_page_setup",
    "sheet_name": "Sales",
    "orientation": "landscape",
    "paper_size": "a4",
    "print_area": "A1:H20",
    "fit_to_width": 1,
    "fit_to_height": 1
  }
]

This print area includes the sample chart. Render the printed page to verify that the report is legible at the chosen scale.

For CSV, change output_path to sales.csv and keep sheet_name: "Sales". CSV/TSV retain displayed cell text, not workbook features such as formulas, charts, and formatting. PDF, HTML, CSV, and TSV exports attempt formula calculation; inspect warnings before relying on the exported values.

Output replacement requires overwrite: true and the existing output’s expected_output_sha256. Use expected_source_sha256 to bind conversion to the inspected input revision. Prefer a fresh output name when no revision evidence is available.

Native-engine limitations

The current MCP implementation documents these limitations in its native dependency:

  • Reading ODS can turn text such as #N/A into an error, remove a leading apostrophe, or normalize CRLF inside cells to LF. Check these values after importing ODS.
  • CJK chart titles can overlap in range and sheet-page images. Use mode: "chart" to check the chart separately. Missing glyphs still require suitable fonts on the host.
  • Inserting a column inside a table can produce a placeholder header such as Column7; write the intended header explicitly.
  • On Windows, output paths close to 260 characters can fail because the temporary filename is longer than the target name. Use a shorter output path.

For command-line conversion and browser preview, see Aspose CLI for Excel.