IRONSOFTWAREHOME
USING IRONXL

Install via .NET CLI (recommended for CI/CD pipelines)

Curtis Chau
Curtis Chau
Updated: August 1, 2026

IronXL enables developers to modify Excel cells in .NET Core applications using straightforward C# code without needing Microsoft Office. It supports cell manipulation, range operations, and deployment on Windows, Linux, and macOS.

Why Use IronXL for .NET Core Excel Development?

Working with Excel in .NET Core is crucial for modern enterprise applications, especially in cloud-native and containerized environments. The IronXL library offers extensive Excel functionality that operates smoothly across platforms without requiring Microsoft Office installations. This capability is particularly valuable for DevOps engineers automating report generation, data processing pipelines, and CI/CD workflows.

Consider a typical scenario: your team needs to generate monthly performance reports from various data sources, modify specific cells based on calculations, and deploy this functionality in Docker containers across multiple environments. Traditional Excel automation would require Office installations on each server, creating licensing headaches and deployment complexities. IronXL eliminates these barriers by providing a self-contained solution that works everywhere your .NET Core applications run.

The library excels at creating spreadsheets from scratch, managing worksheets programmatically, and converting between file formats without external dependencies. Whether you're building microservices, serverless functions, or containerized applications, IronXL integrates naturally into modern DevOps workflows.

Why Choose IronXL for Cloud-Native Excel Processing?

Cloud environments demand lightweight, flexible solutions. IronXL delivers by supporting Docker deployments, Azure Functions, and AWS Lambda out of the box. The library's architecture ensures minimal resource consumption while maintaining high performance, which is crucial for cost-effective cloud operations. You can work with Excel without Interop, making deployments cleaner and more efficient.

Key Capabilities for .NET Core Excel Editing

CapabilityDescription
Cross-platform compatibilityNative support for Windows, Linux, and macOS
Container-readyOptimized for Docker and Kubernetes deployments
Cloud-native integrationWorks smoothly with serverless platforms
No external dependenciesSelf-contained library without Office requirements
Performance optimizedEfficient memory usage for large-scale operations

How to Install the IronXL Library

Getting started with IronXL in your .NET Core project takes just minutes. The library is available through standard package managers and supports all modern deployment scenarios. Here's how to add IronXL to your project:

dotnet add package IronXL.Excel

Or use Package Manager Console in Visual Studio

PM > Install-Package IronXL.Excel

For specific version installation (useful for reproducible builds)

dotnet add package IronXL.Excel --version 2024.12.0

Or, Add to your .csproj file for declarative package management

<PackageReference Include="IronXL.Excel" Version="2024.12.0" />
Text

Configuring Licensing for Production

After installation, configure your license key for production deployments. IronXL offers flexible licensing options suitable for different deployment scales, from single-server applications to enterprise-wide solutions. For web applications, you can configure the license in web.config for centralized management. Consider license extensions for scaling your applications and upgrade options as your needs grow.

Improving IronXL for Container Environments

When deploying to containers, consider these optimization strategies that align with Docker setup best practices:

# Dockerfile example for IronXL applications
FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine AS base
WORKDIR /app

# Install required dependencies for Excel processing
RUN apk add --no-cache \
    icu-libs \
    krb5-libs \
    libgcc \
    libintl \
    libssl1.1 \
    libstdc++ \
    zlib

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["YourProject.csproj", "./"]
RUN dotnet restore "YourProject.csproj"
COPY . .
RUN dotnet build "YourProject.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "YourProject.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "YourProject.dll"]
Text

Quickly Modifying Excel Cells in .NET Core

Here's a practical example demonstrating the core functionality. This code shows how to load an existing Excel file and modify specific cells:

using IronXL;
using System;

class QuickStartExample
{
    static void Main()
    {
        // Load existing Excel file - supports XLSX, XLS, XLSM, XLTX
        WorkBook workBook = WorkBook.Load("sales_report.xlsx");
        
        // Access the default worksheet (usually first sheet)
        WorkSheet sheet = workBook.DefaultWorkSheet;
        
        // Modify individual cells with different data types
        sheet["A1"].Value = "Q4 Sales Report";  // String value
        sheet["B2"].Value = DateTime.Now;       // Date value
        sheet["C2"].Value = 158750.50;          // Numeric value
        
        // Apply formulas for calculations
        sheet["D2"].Formula = "=C2*1.15";       // 15% markup
        sheet["E2"].Formula = "=D2-C2";         // Profit calculation
        
        // Bulk update a range of cells
        sheet["A5:A15"].Value = "Updated by Automation";
        
        // Style the header row
        sheet["A1:E1"].Style.Font.Bold = true;
        sheet["A1:E1"].Style.BackgroundColor = "#1F4788";
        sheet["A1:E1"].Style.Font.Color = "#FFFFFF";
        
        // Save the modified workbook
        workBook.SaveAs("sales_report_updated.xlsx");
        
        Console.WriteLine("Excel file updated successfully!");
    }
}

Why Is This Pattern Ideal for Automation?

This pattern works perfectly in automated workflows because it's deterministic and doesn't require user interaction. You can schedule this code to run in a container, triggered by events or time-based schedules, making it ideal for DevOps automation scenarios. The ability to open Excel worksheets and edit them programmatically enables effective automation possibilities.

Starting a .NET Core Excel Editing Project

Building a reliable Excel editing solution requires proper project setup. Let's create a complete example that demonstrates best practices for production deployments, incorporating error handling and logging:

using IronXL;
using System;
using System.IO;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;

public class ExcelProcessor
{
    private readonly ILogger<ExcelProcessor> _logger;
    private readonly string _workingDirectory;
    
    public ExcelProcessor(ILogger<ExcelProcessor> logger, string workingDirectory)
    {
        _logger = logger;
        _workingDirectory = workingDirectory;
    }
    
    public async Task ProcessExcelFileAsync(string fileName)
    {
        try
        {
            var filePath = Path.Combine(_workingDirectory, fileName);
            
            // Validate file exists
            if (!File.Exists(filePath))
            {
                _logger.LogError($"File not found: {filePath}");
                throw new FileNotFoundException("Excel file not found", fileName);
            }
            
            // Load workbook with error handling
            _logger.LogInformation($"Loading Excel file: {fileName}");
            WorkBook workBook = WorkBook.Load(filePath);
            
            // Process each worksheet
            foreach (var worksheet in workBook.WorkSheets)
            {
                _logger.LogInformation($"Processing worksheet: {worksheet.Name}");
                await ProcessWorksheetAsync(worksheet);
            }
            
            // Save with timestamp for version control
            var outputName = $"{Path.GetFileNameWithoutExtension(fileName)}_processed_{DateTime.Now:yyyyMMddHHmmss}.xlsx";
            var outputPath = Path.Combine(_workingDirectory, "output", outputName);
            
            // Ensure output directory exists
            Directory.CreateDirectory(Path.GetDirectoryName(outputPath));
            
            workBook.SaveAs(outputPath);
            _logger.LogInformation($"Saved processed file: {outputName}");
        }
        catch (Exception ex)
        {
            _logger.LogError(ex, $"Error processing Excel file: {fileName}");
            throw;
        }
    }
    
    private async Task ProcessWorksheetAsync(WorkSheet worksheet)
    {
        // Example: Update timestamp in specific cell
        var timestampCell = worksheet["A1"];
        if (timestampCell.StringValue == "Last Updated:")
        {
            worksheet["B1"].Value = DateTime.Now;
            worksheet["B1"].FormatString = "yyyy-MM-dd HH:mm:ss";
        }
        
        // Example: Process data rows asynchronously
        await Task.Run(() =>
        {
            for (int row = 2; row <= worksheet.RowCount; row++)
            {
                // Skip empty rows
                if (worksheet[$"A{row}"].IsEmpty)
                    continue;
                
                // Apply business logic
                var quantity = worksheet[$"B{row}"].IntValue;
                var price = worksheet[$"C{row}"].DoubleValue;
                worksheet[$"D{row}"].Value = quantity * price;
                worksheet[$"E{row}"].Formula = $"=D{row}*0.08"; // Tax calculation
            }
        });
    }
}

Best Practices for Error Handling

Reliable error handling is crucial for production deployments. The example above demonstrates logging integration and proper exception handling, which are essential for debugging issues in containerized environments where you might not have direct access to the runtime. Consider implementing security measures and reviewing file size limits for your use case.

Editing a Specific Cell Value

Let's explore different techniques for modifying cell values, from simple updates to complex data transformations. IronXL provides intuitive methods to write values to Excel cells while supporting various data types and formats. You can also copy cells and clear cell contents as needed.

using IronXL;
using System;
using System.Linq;
using System.Collections.Generic;

public class CellEditingExamples
{
    public static void DemonstrateVariousCellEdits()
    {
        WorkBook workBook = WorkBook.Load("data.xlsx");
        WorkSheet sheet = workBook.DefaultWorkSheet;
        
        // 1. Simple value assignment
        sheet["A1"].Value = "Product Name";
        sheet["B1"].Value = 99.99;
        sheet["C1"].Value = true;
        sheet["D1"].Value = DateTime.Now;
        
        // 2. Using cell references with variables
        int rowIndex = 5;
        string columnLetter = "E";
        sheet[$"{columnLetter}{rowIndex}"].Value = "Dynamic Reference";
        
        // 3. Setting values with specific formatting
        sheet["F1"].Value = 0.175;
        sheet["F1"].FormatString = "0.00%"; // Display as 17.50%
        
        // 4. Currency formatting
        sheet["G1"].Value = 1234.56;
        sheet["G1"].FormatString = "$#,##0.00"; // Display as $1,234.56
        
        // 5. Date formatting variations
        var dateCell = sheet["H1"];
        dateCell.Value = DateTime.Now;
        dateCell.FormatString = "MMM dd, yyyy"; // Display as "Dec 25, 2024"
        
        // 6. Setting hyperlinks
        sheet["I1"].Value = "Visit Documentation";
        sheet["I1"].Hyperlink = "https://www.example.com";
        
        // 7. Applying conditional formatting
        foreach (var cell in sheet["J1:J10"])
        {
            cell.Value = new Random().Next(0, 100);
            if (cell.IntValue > 50)
            {
                cell.Style.BackgroundColor = "#90EE90"; // Light green for high values
            }
            else
            {
                cell.Style.BackgroundColor = "#FFB6C1"; // Light red for low values
            }
        }
        
        // 8. Working with formulas
        sheet["K1"].Formula = "=SUM(B1:B10)";
        sheet["K2"].Formula = "=AVERAGE(B1:B10)";
        sheet["K3"].Formula = "=IF(K2>50,\"Above Average\",\"Below Average\")";
        
        workBook.SaveAs("data_edited.xlsx");
    }
}
C#

Handling Different Data Types Efficiently

IronXL automatically detects and converts data types, but explicit formatting ensures proper display. The library supports setting cell data formats for currencies, percentages, dates, and custom patterns. You can explore Excel number formats for advanced formatting options. Additionally, you can customize cell fonts and sizes, apply background patterns and colors, and configure cell borders and alignment.

Assigning Values to Multiple Cells

Bulk operations are essential for efficient Excel processing. IronXL provides effective range selection capabilities that make it easy to update multiple cells simultaneously. You can also add rows and columns, insert new rows and columns, and merge cells as needed:

using IronXL;
using System;
using System.Diagnostics;

public class BulkCellOperations
{
    public static void PerformBulkUpdates()
    {
        var stopwatch = Stopwatch.StartNew();
        
        WorkBook workBook = WorkBook.Load("inventory.xlsx");
        WorkSheet sheet = workBook.DefaultWorkSheet;
        
        // Method 1: Update entire column
        sheet["A:A"].Value = "Updated";
        Console.WriteLine($"Column update: {stopwatch.ElapsedMilliseconds}ms");
        
        // Method 2: Update specific range
        sheet["B2:B100"].Value = DateTime.Now.ToShortDateString();
        
        // Method 3: Update entire row
        sheet["1:1"].Style.Font.Bold = true;
        sheet["1:1"].Style.BackgroundColor = "#333333";
        sheet["1:1"].Style.Font.Color = "#FFFFFF";
        
        // Method 4: Update rectangular range
        sheet["C2:E50"].Formula = "=ROW()*COLUMN()";
        
        // Method 5: Update non-contiguous ranges efficiently
        var ranges = new[] { "F1:F10", "H1:H10", "J1:J10" };
        foreach (var range in ranges)
        {
            sheet[range].Value = "Batch Update";
            sheet[range].Style.BottomBorder.Type = BorderType.Double;
        }
        
        // Method 6: Conditional bulk updates
        var dataRange = sheet["K1:K100"];
        foreach (var cell in dataRange)
        {
            // Generate test data
            cell.Value = new Random().Next(1, 1000);
            
            // Apply conditional formatting based on value
            if (cell.IntValue > 750)
            {
                cell.Style.BackgroundColor = "#00FF00"; // Green for high values
                cell.Style.Font.Bold = true;
            }
            else if (cell.IntValue < 250)
            {
                cell.Style.BackgroundColor = "#FF0000"; // Red for low values
                cell.Style.Font.Color = "#FFFFFF";
            }
        }
        
        stopwatch.Stop();
        Console.WriteLine($"Total execution time: {stopwatch.ElapsedMilliseconds}ms");
        
        workBook.SaveAs("inventory_bulk_updated.xlsx");
    }
}

Efficiency of Range Operations

Range operations execute as single commands rather than iterating through individual cells, significantly improving performance. This efficiency becomes crucial when processing large datasets or operating within resource-constrained container environments. The ability to select and manipulate ranges enables effective data transformations with minimal code. You can also sort cell ranges, trim cell ranges, and combine multiple ranges.

Common Range Selection Patterns

PatternSyntaxDescription
Column ranges"A:A"Selects entire column A
Row ranges"1:1"Selects entire row 1
Rectangular ranges"A1:C3"Selects a 3x3 block
Named rangesCreate and use named rangesFor clarity
Dynamic rangesBuild range strings programmaticallyFor flexible selection

Editing Cells with User Inputs

Interactive Excel editing becomes effective when combined with user inputs or external data sources. This approach is valuable for building APIs that accept parameters and generate customized reports. You might want to import Excel data from various sources or export to different formats:

using IronXL;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

public class InteractiveExcelEditor
{
    public class EditRequest
    {
        public string FileName { get; set; }
        public string WorksheetName { get; set; }
        public Dictionary<string, object> CellUpdates { get; set; }
        public List<RangeUpdate> RangeUpdates { get; set; }
    }
    
    public class RangeUpdate
    {
        public string Range { get; set; }
        public object Value { get; set; }
        public CellStyle Style { get; set; }
    }
    
    public class CellStyle
    {
        public string BackgroundColor { get; set; }
        public bool Bold { get; set; }
        public string NumberFormat { get; set; }
    }
    
    public async Task<string> ProcessEditRequestAsync(EditRequest request)
    {
        try
        {
            // Load workbook
            WorkBook workBook = WorkBook.Load(request.FileName);
            WorkSheet sheet = string.IsNullOrEmpty(request.WorksheetName) 
                ? workBook.DefaultWorkSheet 
                : workBook.GetWorkSheet(request.WorksheetName);
            
            // Process individual cell updates
            if (request.CellUpdates != null)
            {
                foreach (var update in request.CellUpdates)
                {
                    var cell = sheet[update.Key];
                    cell.Value = update.Value;
                    
                    // Auto-detect and apply appropriate formatting
                    if (update.Value is decimal || update.Value is double)
                    {
                        cell.FormatString = "#,##0.00";
                    }
                    else if (update.Value is DateTime)
                    {
                        cell.FormatString = "yyyy-MM-dd";
                    }
                }
            }
            
            // Process range updates
            if (request.RangeUpdates != null)
            {
                foreach (var rangeUpdate in request.RangeUpdates)
                {
                    var range = sheet[rangeUpdate.Range];
                    range.Value = rangeUpdate.Value;
                    
                    // Apply styling if provided
                    if (rangeUpdate.Style != null)
                    {
                        if (!string.IsNullOrEmpty(rangeUpdate.Style.BackgroundColor))
                            range.Style.BackgroundColor = rangeUpdate.Style.BackgroundColor;
                        
                        if (rangeUpdate.Style.Bold)
                            range.Style.Font.Bold = true;
                        
                        if (!string.IsNullOrEmpty(rangeUpdate.Style.NumberFormat))
                            range.FormatString = rangeUpdate.Style.NumberFormat;
                    }
                }
            }
            
            // Generate unique output filename
            string outputFile = $"edited_{DateTime.Now:yyyyMMddHHmmss}_{request.FileName}";
            workBook.SaveAs(outputFile);
            
            return outputFile;
        }
        catch (Exception ex)
        {
            throw new InvalidOperationException($"Failed to process edit request: {ex.Message}", ex);
        }
    }
    
    // Example REST API endpoint implementation
    public static async Task<string> HandleApiRequest(string jsonRequest)
    {
        var request = System.Text.Json.JsonSerializer.Deserialize<EditRequest>(jsonRequest);
        var editor = new InteractiveExcelEditor();
        return await editor.ProcessEditRequestAsync(request);
    }
}

Integrating Excel Editing with CI/CD Pipelines

For DevOps scenarios, integrate Excel processing into your build and deployment pipelines. You can read Excel files in ASP.NET applications or work with VB.NET Excel files if needed:

# Example GitHub Actions workflow
name: Process Excel Reports

on:
  schedule:
    - cron: '0 2 * * *' # Run daily at 2 AM
  workflow_dispatch:

jobs:
  process-excel:
    runs-on: ubuntu-latest
    container:
      image: mcr.microsoft.com/dotnet/sdk:6.0
    
    steps:
    - uses: actions/checkout@v2
    
    - name: Restore dependencies
      run: dotnet restore
    
    - name: Build
      run: dotnet build --configuration Release
    
    - name: Process Excel files
      run: |
        dotnet run -- \
          --input-dir ./data/input \
          --output-dir ./data/output \
          --operation bulk-update
    
    - name: Upload processed files
      uses: actions/upload-artifact@v2
      with:
        name: processed-excel-files
        path: ./data/output/*.xlsx
Text

Additional Excel Automation Resources

To expand your Excel automation capabilities, explore these specialized resources:

Advanced Features to Explore

IronXL offers extensive functionality beyond basic cell editing:

Improving Excel Processing Workflows

Consider these advanced techniques:

Quick Reference Guide for Excel Editing

Here's a consolidated reference for common Excel editing operations:

OperationCode ExampleUse Case
Single Cell Editsheet["A1"].Value = "New Value"Update specific data points
Range Editsheet["A1:C10"].Value = "Bulk Update"Batch updates for efficiency
Formula Applicationsheet["D1"].Formula = "=SUM(A1:C1)"Dynamic calculations
Conditional FormattingApply color based on valueVisual data analysis
Date Formattingcell.FormatString = "yyyy-MM-dd"Consistent date display
Currency Formatcell.FormatString = "$#,##0.00"Financial reporting
Merge Cellssheet["A1:C1"].Merge()Create headers and titles
Auto-size Columnssheet.AutoSizeColumn(0)Improve readability

This complete guide demonstrates how IronXL simplifies Excel automation in .NET Core environments. Whether you're building microservices, deploying to containers, or creating serverless functions, IronXL provides the tools needed for efficient Excel processing without external dependencies. Start implementing these patterns in your DevOps workflows today to simplify report generation and data processing tasks.

Curtis Chau
Technical Writer

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

...
Read More

Related Articles

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required