How to Export Audit Results in Different Formats with Open SEO

Open SEO supports JSON export natively through the getAuditResults endpoint and CSV export via a client-side helper, with architecture that allows extension to Excel, PDF, or custom formats by processing the JSON payload.

The every-app/open-seo repository provides flexible export capabilities for audit data, letting you retrieve results programmatically or download them through the web interface. Whether you need raw JSON for integrations or sanitized CSV files for spreadsheet analysis, the codebase provides secure, production-ready utilities. Below is a technical breakdown of the export mechanisms, including the exact file locations and implementation patterns.

Native JSON Export via the API

At the core of Open SEO’s export functionality is the getAuditResults server function, which returns complete audit data as a structured JSON payload.

The getAuditResults Endpoint

Located in src/serverFunctions/audit.ts, this endpoint serves as the primary data source for all export formats. It accepts auditId and projectId parameters via POST request and returns a JSON object containing issues, pages, and Lighthouse results. This is the default programmatic format and can be consumed by any HTTP client.

The endpoint draws data from the audit workflow orchestrated in src/server/workflows/siteAuditWorkflowPhases.ts, where results are stored after processing. Because the JSON structure is standardized, you can pipe this response into any downstream transformation pipeline.

CSV Export for Tabular Data

For users needing spreadsheet-compatible output, Open SEO includes a dedicated CSV utility that handles data sanitization and browser downloads.

Secure CSV Generation

The src/client/lib/csv.ts file contains the downloadCsv helper, which automatically sanitizes cell values to prevent CSV injection attacks. This ensures that malicious payloads cannot be executed when audit results are opened in Excel or other spreadsheet applications.

The helper accepts an array of row objects and a filename, converting the data to a properly escaped CSV string before triggering the browser download.

UI Integration

The export button visible in the audit dashboard is implemented in src/routes/_project/p/$projectId/audit.tsx. When clicked, it invokes the CSV helper to generate a downloadable file containing all audit issues, their severity levels, and affected URLs.

Extending to Custom Formats (Excel, PDF, Google Sheets)

Because the getAuditResults endpoint returns a comprehensive JSON payload, you are not limited to the built-in CSV exporter. You can transform the data into additional formats using standard JavaScript libraries:

  • Excel (XLSX) – Pipe the JSON response into libraries like sheetjs to generate .xlsx files with multiple worksheets.
  • PDF – Use templating engines such as puppeteer or pdfmake to render audit reports into printable documents.
  • Google Sheets – Authenticate with the Google Sheets API and push the JSON data directly using googleapis.

The open architecture means you only need to call the JSON endpoint once, then process the results client-side or in a separate microservice to achieve your desired output format.

Implementation Examples

The following TypeScript examples demonstrate how to fetch raw audit data and convert it to CSV using the built-in utilities.

Fetch audit results as JSON:

import { getAuditResults } from "@/serverFunctions/audit";

async function fetchAuditJson(auditId: string, projectId: string) {
  const response = await getAuditResults({
    auditId,
    projectId,
  });
  return response; // JSON object containing audit data
}

Export audit issues to CSV client-side:

import { downloadCsv } from "@/client/lib/csv";
import { getAuditResults } from "@/serverFunctions/audit";

async function exportAuditToCsv(auditId: string, projectId: string) {
  const data = await getAuditResults({ auditId, projectId });
  const rows = data.issues.map(issue => ({
    type: issue.type,
    severity: issue.severity,
    message: issue.message,
    url: issue.url,
  }));
  downloadCsv(rows, `audit-${auditId}.csv`);
}

Summary

  • JSON is the native format returned by getAuditResults in src/serverFunctions/audit.ts, serving as the foundation for all exports.
  • CSV export is available out-of-the-box via src/client/lib/csv.ts, which includes security sanitization to prevent injection attacks.
  • The UI export button is located in src/routes/_project/p/$projectId/audit.tsx and leverages the CSV helper for downloads.
  • Custom formats (Excel, PDF, Google Sheets) can be generated by transforming the JSON payload client-side using third-party libraries.
  • Audit data origin traces back to src/server/workflows/siteAuditWorkflowPhases.ts, ensuring consistency across all export methods.

Frequently Asked Questions

What format does the Open SEO audit API return by default?

According to the every-app/open-seo source code, the getAuditResults endpoint in src/serverFunctions/audit.ts returns a JSON object by default. This payload contains nested data for audit issues, page-level metrics, and Lighthouse scores, making it suitable for programmatic consumption and further processing.

Does Open SEO support Excel or PDF export out of the box?

No, CSV is the only built-in tabular format provided by the UI. However, because the API returns comprehensive JSON data, you can easily generate Excel or PDF files by piping the response through libraries like sheetjs (for XLSX) or puppeteer (for PDF) in your client application or automation pipeline.

How does Open SEO prevent CSV injection attacks?

The src/client/lib/csv.ts file implements a sanitization routine that escapes or strips potentially dangerous characters (such as leading equals signs or plus signs) from cell values before generating the CSV file. This prevents spreadsheet applications from interpreting audit data as executable formulas or commands.

Can I automate audit exports without using the web UI?

Yes. Since getAuditResults is a server function that accepts auditId and projectId parameters, you can call it directly from any automated script or CI/CD pipeline using a POST request. Retrieve the JSON data and process it into your preferred format without ever loading the React frontend.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →