This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using FileFormat.Cells | |
string filePath = "/Users/fahadadeelqazi/Downloads/spreadsheet.xlsx"; | |
using (Workbook wb = new Workbook(filePath)) | |
{ | |
Worksheet firstSheet = wb.Worksheets[1]; | |
Cell cell = firstSheet.Cells["D2"]; | |
cell.PutValue("Fahad"); | |
wb.Save(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (Workbook wb = new Workbook(filePath)) // Load existing spreadsheet/workbook file. | |
{ | |
Worksheet firstSheet = wb.Worksheets[0]; // Load first worksheet within workbook. | |
Cell cellA1 = firstSheet.Cells["A1"]; // Get A1 cell object within cellA1 variable. | |
Console.WriteLine(cellA1.GetDataType()); // Output cellA1 data type. | |
string value = cellA1.GetValue(); // Get value within cell A1. | |
Console.WriteLine(value); // Output the value stored in cell A1 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This example demonstrates how to add formulas to cells in a workbook. | |
using (Workbook wb = new Workbook()) | |
{ | |
// Accessing the first worksheet in the workbook. | |
Worksheet firstSheet = wb.Worksheets[0]; | |
// Create a random number generator. | |
Random rand = new Random(); | |
// Loop through the first 10 rows in column A. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a new workbook and set cell values and document properties. | |
using (var workbook = new Workbook()) | |
{ | |
// Access the first worksheet. | |
Worksheet firstSheet = workbook.Worksheets[0]; | |
// Set values for cells A1 and A2. | |
Cell cellA1 = firstSheet.Cells["A1"]; | |
cellA1.PutValue("Text A1"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string filePath = "/path/to/existing/spreadsheet.xlsx"; // Replace with the path to your file | |
// Open the existing workbook. | |
using (var workbook = new Workbook(filePath)) | |
{ | |
// Retrieve and display the document properties. | |
var properties = workbook.BuiltinDocumentProperties; | |
DisplayProperties(properties); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string filePath = "/path/to/existing/spreadsheet.xlsx"; // Replace with the path to your file | |
// Open the existing workbook. | |
using (var workbook = new Workbook(filePath)) | |
{ | |
// Add a new worksheet to the workbook. | |
Worksheet newSheet = workbook.AddSheet("NewWorksheetName"); // Replace 'NewWorksheetName' with the desired name | |
// You can also add some content to the new worksheet if needed. | |
Cell cellA1 = newSheet.Cells["A1"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using FileFormat.Cells; | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
string filePath = "Z:\\Downloads\\test_spreadsheet.xlsx"; // Replace with the path to your file | |
using (var workbook = new Workbook(filePath)) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using FileFormat.Cells; | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
string filePath = "Z:\\Downloads\\test_spreadsheet.xlsx"; // Replace with the path to your file | |
using (var workbook = new Workbook(filePath)) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using FileFormat.Cells; | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
// Define the path to the existing spreadsheet | |
string filePath = "Z:\\Downloads\\test_spreadsheet.xlsx"; | |
// Open the existing workbook specified by the filePath |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Import necessary namespace | |
using FileFormat.Cells; | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
// Define the path to the existing spreadsheet | |
string filePath = "Z:\\Downloads\\test_spreadsheet1.xlsx"; |
OlderNewer