Link Search Menu Expand Document

Read Formula From Cell - C#

Spreadsheet SDK sample in C# demonstrating ‘Read Formula From Cell’

Program.cs
using System;
using System.Collections.Generic;
using System.Text;
using Bytescout.Spreadsheet;

namespace HelloWorld
{
    class Program
    {
        static void Main(string[] args)
        {
            // Create new Spreadsheet
            Spreadsheet document = new Spreadsheet();
	document.LoadFromFile("sample.xls");

            // get the very first worksheet
            Worksheet sheet = document.Worksheet(0);

            Console.WriteLine("reading total price formula from cell B5");
            // we use .Formula value to read from the B5 cell
            Console.WriteLine("Formula in B5 cell is: " + sheet.Cell("B5").Formula);
            Console.WriteLine("\npress any key to continue");
            Console.ReadKey();
}
    }
}

Download Source Code (.zip)

Return to the previous page Explore Spreadsheet SDK