npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mermaid-sequence-excel

v0.1.0

Published

Convert Mermaid sequence diagrams into editable Excel worksheets.

Readme

mermaid-sequence-excel

Convert Mermaid sequenceDiagram scripts into editable Excel worksheets.

This package does not render Mermaid as an image. It parses the sequence diagram and writes a Mermaid-like worksheet with styled cells for participants, notes, frames, activation bars, and lifelines. Message arrows are injected as editable Excel drawing objects in the .xlsx package, so Microsoft Excel is not required at generation time.

Install

npm install mermaid-sequence-excel

Usage

From the command line:

npx mermaid-sequence-excel checkout.md
npx mermaid-sequence-excel checkout.md -o checkout-flow.xlsx
npx mermaid-sequence-excel checkout.md checkout-flow.xlsx
npx mermaid-sequence-excel checkout.mmd --title "Checkout Flow"

Markdown input can contain a Mermaid fence:

# Checkout flow

```mermaid
sequenceDiagram
actor User
participant API
User->>API: Create order
API->>API: Validate request
API-->>User: Done
```

If --output is omitted, the CLI writes an .xlsx file next to the input file.

CLI options:

mermaid-sequence-excel <input.md|input.mmd> [options]
mermaid-sequence-excel <input.md|input.mmd> <output.xlsx>

-o, --output <file>          Output xlsx path
    --title <text>           Worksheet title
    --worksheet-name <name>  Diagram worksheet name
    --no-source              Do not include the Source sheet
    --no-parsed              Do not include the Parsed sheet
    --no-warnings            Do not include the Warnings sheet

As a library:

import { writeSequenceDiagramXlsxFile } from 'mermaid-sequence-excel';

const source = `sequenceDiagram
title Checkout API flow
actor User
participant Web as Web App
participant API as API Server

User->>Web: Click checkout
Web->>+API: POST /orders
API-->>-Web: Order created
Web-->>User: Show receipt`;

await writeSequenceDiagramXlsxFile(source, './checkout-flow.xlsx');

Browser download:

import { writeSequenceDiagramXlsxBlob } from 'mermaid-sequence-excel';

const blob = await writeSequenceDiagramXlsxBlob(source);
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'sequence-diagram.xlsx';
a.click();
URL.revokeObjectURL(url);

Use with an existing ExcelJS workbook:

import ExcelJS from 'exceljs';
import {
  addSequenceDiagramWorksheet,
  writeWorkbookWithSequenceDrawingsFile,
} from 'mermaid-sequence-excel';

const workbook = new ExcelJS.Workbook();
const { diagram, worksheet } = addSequenceDiagramWorksheet(workbook, source, {
  worksheetName: 'Flow',
  includeParsedSheet: true,
  includeSourceSheet: true,
  includeWarningsSheet: true,
});

console.log(diagram.participants.length, worksheet.name);
await writeWorkbookWithSequenceDrawingsFile(workbook, './flow.xlsx');

workbook.xlsx.writeFile() will only write the cell layout. Use writeWorkbookWithSequenceDrawingsFile() or writeWorkbookWithSequenceDrawingsBuffer() when you need the arrow drawing objects.

Supported Mermaid syntax

  • sequenceDiagram
  • title
  • autonumber
  • participant, actor, create participant
  • Messages: ->, -->, ->>, -->>, -x, --x, -), --)
  • Self messages such as A->>A: refresh are rendered with a circular arrow shape.
  • Activation markers: activate, deactivate, destroy, ->>+, -->>-
  • Notes: Note left of, Note right of, Note over
  • Blocks: loop, alt, else, opt, par, and, critical, break, rect, box, end

Unsupported lines are preserved as warning rows in the Excel sheet and surfaced in diagram.warnings.

API

parseSequenceDiagram(source): ParsedSequenceDiagram
addSequenceDiagramWorksheet(workbook, source, options?): SequenceWorksheetResult
createSequenceDiagramWorkbook(source, options?): Promise<SequenceWorkbookResult>
writeSequenceDiagramXlsxBuffer(source, options?): Promise<ArrayBuffer>
writeSequenceDiagramXlsxBlob(source, options?): Promise<Blob>
writeSequenceDiagramXlsxFile(source, outputPath, options?): Promise<ParsedSequenceDiagram>
writeWorkbookWithSequenceDrawingsBuffer(workbook): Promise<ArrayBuffer>
writeWorkbookWithSequenceDrawingsFile(workbook, outputPath): Promise<void>

Options:

interface SequenceExcelOptions {
  worksheetName?: string;
  parsedWorksheetName?: string;
  sourceWorksheetName?: string;
  warningsWorksheetName?: string;
  title?: string;
  includeParsedSheet?: boolean;
  includeSourceSheet?: boolean;
  includeWarningsSheet?: boolean;
}

By default, generated workbooks include Diagram, Parsed, Source, and Warnings sheets.

Publish

npm run build
npm test
npm publish --access public