ByteScout Spreadsheet SDK - C# - Set Cell Formula - ByteScout
Announcement
Our ByteScout SDK products are sunsetting as we focus on expanding new solutions.
Learn More Open modal
Close modal
Announcement Important Update
ByteScout SDK Sunsetting Notice
Our ByteScout SDK products are sunsetting as we focus on our new & improved solutions. Thank you for being part of our journey, and we look forward to supporting you in this next chapter!

ByteScout Spreadsheet SDK – C# – Set Cell Formula

  • Home
  • /
  • Articles
  • /
  • ByteScout Spreadsheet SDK – C# – Set Cell Formula

How to set cell formula in C# with ByteScout Spreadsheet SDK

The tutorial below will demonstrate how to set cell formula in C#

Learn how to set cell formula in C# with this source code sample. ByteScout Spreadsheet SDK can set cell formula. It can be used from C#. ByteScout Spreadsheet SDK is the SDK to create, read, modify and calculate spreadsheets. Formula calculations are supported, import and export to and from JSON, CSV, XML, databases, arrays.

This rich sample source code in C# for ByteScout Spreadsheet SDK includes the number of functions and options you should do calling the API to set cell formula. Just copy and paste the code into your C# application’s code and follow the instruction. Enjoy writing a code with ready-to-use sample C# codes.

ByteScout free trial version is available for download from our website. It includes all these programming tutorials along with source code samples.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

Program.cs
      
using System; using System.Collections.Generic; using System.Text; using Bytescout.Spreadsheet; using System.Diagnostics; using System.IO; namespace HelloWorld { class Program { static void Main(string[] args) { // Create new Spreadsheet Spreadsheet document = new Spreadsheet(); // add new worksheet Worksheet Sheet = document.Workbook.Worksheets.Add("FormulaDemo"); // headers to indicate purpose of the column Sheet.Cell("A1").Value = "Formula (as text)"; // set A column width Sheet.Columns[0].Width = 250; Sheet.Cell("B1").Value = "Formula (calculated)"; // set B column width Sheet.Columns[1].Width = 250; // write formula as text Sheet.Cell("A2").Value = "7*3+2"; // write formula as formula Sheet.Cell("B2").Value = "=7*3+2"; // delete output file if exists already if (File.Exists("Output.xls")){ File.Delete("Output.xls"); } // Save document document.SaveAs("Output.xls"); // Close Spreadsheet document.Close(); // open generated XLS document in default program Process.Start("Output.xls"); } } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Spreadsheet SDK Home Page

Explore ByteScout Spreadsheet SDK Documentation

Explore Samples

Sign Up for ByteScout Spreadsheet SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Spreadsheet SDK Home Page

Explore ByteScout Spreadsheet SDK Documentation

Explore Samples

Sign Up for ByteScout Spreadsheet SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next