# Weekly support rota and coverage

Create a colour-coded Excel support rota with desk-day totals and daily coverage counts calculated from shift codes. Download the editable workbook.

Excel · C# walkthrough

Spot coverage gaps while keeping the underlying assignments editable.

[Build this report](#example-code)[Download XLSX](/downloads/showcase/workflows/excel-workforce-rota/example.xlsx) [Try this file in your browser](/browser/excel-to-pdf/)

Opens the generated download in a local browser tool. The C# example below creates the document.

**Start with**

Team members and daily shift codes

**Generate**

XLSX

[!\[Generated Excel example: Weekly support rota and coverage\](/downloads/showcase/workflows/excel-workforce-rota/preview.webp)](/downloads/showcase/workflows/excel-workforce-rota/preview.png)

Generated worksheet · Generated by the example below

## How it works

1. ### Record assignments
  
  Use D, R and a dash consistently for desk, remote and off.
2. ### Calculate coverage
  
  Count desk assignments per person and per day.
3. ### Review before sharing
  
  Keep the legend and scope limits beside the table.

## The C# source

The example below shows the document API and layout used for this report. Follow the Excel guide for package setup in your own project.

```csharp
using OfficeIMO.Drawing;
using OfficeIMO.Excel;

namespace OfficeIMO.Examples.Showcase.Workflows {
    /// <summary>Creates an editable weekly support rota with visible calculations and a native range preview.</summary>
    internal static class WorkforceRota {
        internal static void Create(string folder) {
            using var document = ExcelDocument.Create(Path.Combine(folder, "example.xlsx"));
            var sheet = document.AddSheet("Rota");
            // Day columns hold one letter; narrow widths keep the rota on one page at full size.
            sheet.SetColumnWidth(1, ExcelColumnWidth.Characters(18));
            for (int column = 2; column <= 6; column++) sheet.SetColumnWidth(column, ExcelColumnWidth.Characters(9));
            sheet.SetColumnWidth(7, ExcelColumnWidth.Characters(12));
            sheet.Range("A1:G1").Merge(); sheet.Cell(1, 1).SetValue("Weekly support rota");
            sheet.Cell(1, 1).SetFontSize(global::OfficeIMO.OfficeLength.Points(22)); sheet.Cell(1, 1).SetBold(true); sheet.Cell(1, 1).SetColor(OfficeColor.Parse("17365D"));
            sheet.Range("A2:G2").Merge(); sheet.Cell(2, 1).SetValue("One assigned shift per day / D = desk / R = remote / - = off");
            string[] headers = { "Team member", "Mon", "Tue", "Wed", "Thu", "Fri", "Desk days" };
            for (int column = 1; column <= 7; column++) sheet.Cell(4, column).SetValue(headers[column - 1]);
            string[] names = { "Maya", "Leon", "Sofia", "Amir" };
            string[][] shifts = { new[] { "D", "D", "R", "-", "R" }, new[] { "R", "-", "D", "D", "R" }, new[] { "D", "R", "-", "R", "D" }, new[] { "-", "D", "R", "D", "D" } };
            for (int index = 0; index < names.Length; index++) {
                int row = index + 5; sheet.Cell(row, 1).SetValue(names[index]);
                for (int column = 2; column <= 6; column++) {
                    string shift = shifts[index][column - 2]; sheet.Cell(row, column).SetValue(shift);
                }
                sheet.Cell(row, 7).SetFormula($"COUNTIF(B{row}:F{row},\"D\")");
            }
            sheet.AddTable("A4:G8", true, "SupportRota", ExcelTableStyle.TableStyleMedium2);
            // Rules follow edited shifts in Excel and in the native range preview.
            sheet.Range("B5:F8").Validation().List(new[] { "D", "R", "-" }, allowBlank: false);
            sheet.Range("B5:F8").ConditionalFormat().Text(ExcelConditionalFormatType.ContainsText, "D", OfficeColor.Parse("DCFCE7"));
            sheet.Range("B5:F8").ConditionalFormat().Text(ExcelConditionalFormatType.ContainsText, "R", OfficeColor.Parse("DBEAFE"));
            sheet.Range("B5:F8").ConditionalFormat().Text(ExcelConditionalFormatType.ContainsText, "-", OfficeColor.Parse("F1F5F9"));
            sheet.Cell(10, 1).SetValue("Desk coverage");
            for (int column = 2; column <= 6; column++) {
                string letter = ((char)('A' + column - 1)).ToString();
                sheet.Cell(10, column).SetFormula($"COUNTIF({letter}5:{letter}8,\"D\")"); sheet.Cell(10, column).SetBold(true);
            }
            sheet.Range("A12:G12").Merge(); sheet.Cell(12, 1).SetValue("Review coverage before sharing. Names and shifts are synthetic.");
            sheet.Range("A13:G13").Merge(); sheet.Cell(13, 1).SetValue("This records a rota; it does not check working-time rules or approve leave.");
            sheet.View.ShowGridlines = false;
            for (int row = 1; row <= 16; row++) {
                sheet.SetRowHeight(row, ExcelColumnWidth.Length(OfficeIMO.OfficeLength.Points(row == 1 ? 34 : row == 3 ? 12 : 25)));
                for (int column = 1; column <= 7; column++) {
                    if (row > 1) sheet.Cell(row, column).SetFontSize(OfficeLength.Points(11));
                }
            }
            sheet.SetRowHeight(4, ExcelColumnWidth.Length(OfficeIMO.OfficeLength.Points(30)));
            for (int column = 1; column <= 7; column++) {
                sheet.Cell(4, column).SetColor(OfficeColor.Parse("FFFFFF"));
                sheet.Cell(4, column).SetBold(true);
                sheet.Cell(4, column).SetFillColor(OfficeColor.Parse("17365D"));
            }
            document.Calculate();
            document.InspectFormulas().EnsureAllSupported().EnsureAllHaveCachedResults().EnsureNoDependencyIssues();
            sheet.Range("A1:G14").ToImage(OfficeImageExportFormat.Png, new ExcelImageExportOptions { ShowGridlines = false })
                .Save(Path.Combine(folder, "preview.png"), OfficeImageExportFileConflictPolicy.Replace);
            document.Save();
        }
    }
}
```

[Open the C# source file](/downloads/showcase/workflows/excel-workforce-rota/WorkforceRota.cs.txt)

## API used in this example

- [`OfficeColor`](/api/core/officeimo-officecolor/)
- [`ExcelColumnWidth`](/api/excel/officeimo-excel-excelcolumnwidth/)
- [`OfficeLength`](/api/core/officeimo-officelength/)
- [`ExcelConditionalFormatType`](/api/excel/officeimo-excel-excelconditionalformattype/)
- [`ExcelDocument`](/api/excel/officeimo-excel-exceldocument/)
- [`ExcelImageExportOptions`](/api/excel/officeimo-excel-excelimageexportoptions/)
- [`ExcelTableStyle`](/api/excel/officeimo-excel-exceltablestyle/)
- [`OfficeImageExportFileConflictPolicy`](/api/core/officeimo-drawing-officeimageexportfileconflictpolicy/)
- [`OfficeImageExportFormat`](/api/core/officeimo-drawing-officeimageexportformat/)

## Use this in your project

Use your actual shift codes and staffing rules; this example does not validate working-time or leave policies.

The [Excel guide](/docs/excel/) explains package setup and related document APIs.

## Documents and scope

### What the preview shows

The C# source generates the downloadable file. The runner validates the workbook and supported formulas, cached results and dependencies. The PNG is a native range export.

### What to keep in mind

Use your actual shift codes and staffing rules; this example does not validate working-time or leave policies.

[Excel API reference](/api/excel/) · [Artifact hashes and provenance](/downloads/showcase/manifest.json)

## Continue with another example

- [Excel**Budget scenario comparison**](/showcase/excel-budget-scenarios/)
- [Excel**Pricing with named ranges**](/showcase/excel-named-range-pricing/)

<!-- PowerForge markdown artifact sha256:D1AC976BE24C7D3D5763CB8ABC8B19110B39578F510D0360629B111BD9BE2513 -->
