How to change data in an existing Excel (XLS) document using Bytescout Spreadsheet SDK
This source code sample demonstrates how to use Bytescout Spreadsheet SDK to change data in an existing Excel (.XLS) document and save changed file as a new one.
Download example source code: bytescoutxls_changing_data_in_existing_xls.zip (8 KB)
Source document screenshot:
Modified document screenshot (see Homer’s Full Name changed)
using System;
using System.Collections.Generic;
using System.Text;
using Bytescout.Spreadsheet;
namespace Changing_data_in_existing_XLS
{
class Program
{
static void Main(string[] args)
{
// Open Spreadsheet
Spreadsheet document = new Spreadsheet(“AdvancedReport.xls”);
// Get Worksheet
Worksheet worksheet = document.Workbook.Worksheets[0];
// Set cell value
worksheet.Cell(1, 1).Value = “Homer Jay Simpson 2”;
// Save document
document.SaveAs(“AdvancedReport1.xls”);
// Close Spreadsheet
document.Close();
}
}
}
Download example source code: bytescoutxls_changing_data_in_existing_xls.zip (8 KB)