Created
March 28, 2024 07:17
-
-
Save fileformat-cells-gists/0779e0b4e8da19cc73e11ed080fc2f1d to your computer and use it in GitHub Desktop.
This C# example showcases how to open an existing MS excel workbook and insert text into a specified cell using the FileFormat.Cells library.
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 = "Z:\\Downloads\\testFile1.xlsx"; | |
// Load the workbook from the specified file path | |
using (Workbook wb = new Workbook(filePath)) | |
{ | |
// Access the first worksheet in the workbook | |
Worksheet firstSheet = wb.Worksheets[0]; | |
// Define the cellReference | |
string cellReference = "B10"; | |
Cell cell = firstSheet.Cells[cellReference]; | |
// Insert the actual value to the cell. | |
cell.PutValue("randomValue"); | |
wb.Save(filePath); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment