With this source code sample you may quickly learn how to calculate XIRR function in C#. ByteScout Spreadsheet SDK: the library (SDK) that is capable of writing, reading, modifying and calculating Excel and CSV spreadsheets. Most popular formulas can be calculated and reculculated with Excel installed. You may import or export data to and from CSV, XML, JSON as well as to and from databases, arrays. It can calculate XIRR function in C#.
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 calculate XIRR function. In your C# project or application you may simply copy & paste the code and then run your app! Implementing C# application typically includes multiple stages of the software development so even if the functionality works please test it with your data and the production environment.
Trial version of ByteScout Spreadsheet SDK is available for free. Source code samples are included to help you with your C# app.
On-demand (REST Web API) version:
Web API (on-demand version)
On-premise offline SDK for Windows:
60 Day Free Trial (on-premise)
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
using Bytescout.Spreadsheet;
namespace CSharp
{
class Program
{
static void Main(string[] args)
{
// Create new Spreadsheet
Spreadsheet document = new Spreadsheet();
// Set locale
document.Workbook.Locale = new System.Globalization.CultureInfo("en-US");
// Add new worksheet
Worksheet worksheet = document.Workbook.Worksheets.Add();
// Fill some data
worksheet.Cell(1, 1).Value = new DateTime(2008, 01, 01);
worksheet.Cell(1, 2).Value = 100;
worksheet.Cell(2, 1).Value = new DateTime(2009, 01, 01);
worksheet.Cell(2, 2).Value = -200;
// Apply function
worksheet.Cell(4, 1).Formula = "=XIRR(C2:C3,B2:B3,0)";
// Read value
worksheet.Cell(4, 2).Value = worksheet.Cell(4, 1).Value;
// 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");
}
}
}
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
Get Your API Key
Explore Web API Docs
Explore Web API Samples
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
Get Your API Key
Explore Web API Docs
Explore Web API Samples
also available as: