FormulaEngineer — A Highly Accurate Excel Formula Engine with support for 430+ Excel functions — explore the complete list NEW3.0.1

FormulaEngineer examples

Create, read, and style Excel workbooks in .NET.

Style workbooks as you write them — fonts, fills, borders, number formats, alignment, and layout — using ExcelStyledWriter. Every example below is a complete, runnable snippet.

Group
Example
4 examples in Dashboards

Customer success KPI dashboard

EnableCharts EnableSparklines EnableConditionalFormatting EnableShapes

The fullest example on this page — segment health scores with sparklines, a colour scale on the average, data bars on churn risk, an executive callout, and a chart, all on one sheet.

Write.cs
using FormulaEngineer.Api;
using FormulaEngineer.Api.Styling;

var options = new ExcelStylingOptions
{
    EnableCharts = true,
    EnableSparklines = true,
    EnableConditionalFormatting = true,
    EnableShapes = true
};

var titleStyle = ExcelStyle.Default.With(
    font: ExcelFontStyle.Default.With(bold: true, size: 16d, color: ExcelColor.FromRgb(255, 255, 255)),
    fill: ExcelFillStyle.Solid(ExcelColor.FromRgb(31, 78, 121)),
    alignment: ExcelAlignmentStyle.Default.With(horizontal: ExcelHorizontalAlignment.Center));

var headerStyle = ExcelStyle.Default.With(
    font: ExcelFontStyle.Default.With(bold: true, color: ExcelColor.FromRgb(255, 255, 255)),
    fill: ExcelFillStyle.Solid(ExcelColor.FromRgb(68, 114, 196)),
    alignment: ExcelAlignmentStyle.Default.With(horizontal: ExcelHorizontalAlignment.Center));

var percentStyle = ExcelStyle.Default.With(numberFormat: ExcelNumberFormatStyle.Custom("0.0%"));
var numberStyle = ExcelStyle.Default.With(numberFormat: ExcelNumberFormatStyle.Custom("#,##0"));
var scoreStyle = ExcelStyle.Default.With(numberFormat: ExcelNumberFormatStyle.Custom("0.0"));

using (var writer = new ExcelStyledWriter("customer-success-kpi-dashboard.xlsx", null, options))
{
    using (var sheet = writer.CreateWorksheet("Customer Success"))
    {
        sheet.MergeCells(1, 1, 1, 9);
        sheet.SetColumnStyle(1, ExcelColumnStyle.Default.With(width: 18d));
        sheet.SetColumnStyle(2, ExcelColumnStyle.Default.With(width: 11d, style: numberStyle));
        sheet.SetColumnStyle(3, ExcelColumnStyle.Default.With(width: 11d, style: numberStyle));
        sheet.SetColumnStyle(4, ExcelColumnStyle.Default.With(width: 11d, style: numberStyle));
        sheet.SetColumnStyle(5, ExcelColumnStyle.Default.With(width: 11d, style: numberStyle));
        sheet.SetColumnStyle(6, ExcelColumnStyle.Default.With(width: 12d, style: scoreStyle));
        sheet.SetColumnStyle(7, ExcelColumnStyle.Default.With(width: 12d, style: percentStyle));
        sheet.SetColumnStyle(8, ExcelColumnStyle.Default.With(width: 14d));
        sheet.SetColumnStyle(9, ExcelColumnStyle.Default.With(width: 14d));

        sheet.AddSparklineGroup(
            ExcelSparklineGroup.Create(
                new[]
                {
                    ExcelSparkline.Create("'Customer Success'!$B$4:$E$4", 4, 8),
                    ExcelSparkline.Create("'Customer Success'!$B$5:$E$5", 5, 8),
                    ExcelSparkline.Create("'Customer Success'!$B$6:$E$6", 6, 8),
                    ExcelSparkline.Create("'Customer Success'!$B$7:$E$7", 7, 8)
                },
                type: ExcelSparklineType.Line,
                showMarkers: true,
                showHighPoint: true,
                showLowPoint: true));

        sheet.WriteRow(new object?[] { "Customer Success KPI Dashboard" }, titleStyle);
        sheet.WriteRow();
        sheet.WriteRow(new object?[] { "Segment", "Jan", "Feb", "Mar", "Apr", "Avg score", "Churn risk", "Trend", "Status" }, headerStyle);

        sheet.WriteRow(new object?[] { "Enterprise", 94, 96, 95, 98, ExcelFormula.From("AVERAGE(B4:E4)"), 0.025, null, "Excellent" },
            new ExcelStyle?[] { null, numberStyle, numberStyle, numberStyle, numberStyle, scoreStyle, percentStyle, null, null });

        sheet.WriteRow(new object?[] { "Mid Market", 86, 88, 84, 90, ExcelFormula.From("AVERAGE(B5:E5)"), 0.061, null, "Healthy" },
            new ExcelStyle?[] { null, numberStyle, numberStyle, numberStyle, numberStyle, scoreStyle, percentStyle, null, null });

        sheet.WriteRow(new object?[] { "SMB", 72, 69, 75, 71, ExcelFormula.From("AVERAGE(B6:E6)"), 0.142, null, "Watch" },
            new ExcelStyle?[] { null, numberStyle, numberStyle, numberStyle, numberStyle, scoreStyle, percentStyle, null, null });

        sheet.WriteRow(new object?[] { "Trial", 58, 62, 65, 68, ExcelFormula.From("AVERAGE(B7:E7)"), 0.210, null, "Improve" },
            new ExcelStyle?[] { null, numberStyle, numberStyle, numberStyle, numberStyle, scoreStyle, percentStyle, null, null });

        sheet.AddConditionalFormat("G4:G7", ExcelConditionalFormat.DataBar(ExcelColor.FromRgb(237, 125, 49)));
        sheet.AddConditionalFormat("F4:F7", ExcelConditionalFormat.ThreeColorScale(
            ExcelConditionalFormatValue.Minimum, ExcelColor.FromRgb(248, 105, 107),
            ExcelConditionalFormatValue.Percentile(50), ExcelColor.FromRgb(255, 235, 132),
            ExcelConditionalFormatValue.Maximum, ExcelColor.FromRgb(99, 190, 123)));

        sheet.AddShape(
            ExcelShape.Create(
                ExcelShapeKind.RoundedRectangle,
                ExcelDrawingAnchor.OneCell(11, 2, 220d, 70d),
                text: ExcelShapeText.Create("Focus: reduce SMB churn"),
                name: "Executive callout"));

        sheet.AddChart(
            ExcelChart.Create(
                ExcelChartKind.ColumnClustered,
                ExcelDrawingAnchor.OneCell(1, 10, 620d, 300d),
                new[]
                {
                    ExcelChartSeries.Create("Avg score", "'Customer Success'!$A$4:$A$7", "'Customer Success'!$F$4:$F$7")
                },
                title: "Average customer health score",
                categoryAxisTitle: "Segment",
                valueAxisTitle: "Score"));
    }

    writer.Close();
}

Style your own workbooks

Styling is part of the same package — no separate install, no Excel, no COM automation.