For a developer, who is trying to update XLSX files via .NET application. Aspose.Total for .NET API can help to automate the updating process. It’s a full package of various .NET APIs dealing different formats including Microsoft Excel files. Aspose.Cells for .NET API that is part of Aspose.Total for .NET package makes this modifying process easy. Below is the process of updating the XLSX document.
How to Update XLSX File in .NET
- Create new Workbook class object having the source XLSX file as parameter
- Access of relevant Worksheet and relevant cell using Worksheets[0].Cells[column] method
- Insert new data in the accessed cell using PutValue(data) method
- Save the file as .xlsx file using save() method by passing the file with path as the parameter
Modification Requirements
- For XLSX modification, Microsoft Windows or a compatible OS with .NET, .NET Core, Mono or Xamarin Platforms
- Development environment like Microsoft Visual Studio
- Install from command line as
nuget install Aspose.Cells
or via Package Manager Console of Visual Studio withInstall-Package Aspose.Cells
- Alternatively, get the offline MSI installer or all DLLs in a ZIP file from Downloads
Code - Update XLSX File in .NET
Workbook wkb = new Workbook("sourceFile.xlsx"); | |
Cell cellWithData = wkb.Worksheets[0].Cells["A1"]; | |
cellWithData.Value = 100; | |
Cell cellWithFormula = wkb.Worksheets[1].Cells["C1"]; | |
cellWithFormula.Formula = "=Sum(A1,A20)"; | |
wkb.CalculateFormula(); | |
Worksheet sheet = wkb.Worksheets[1]; | |
Cell cell = sheet.Cells["A1"]; | |
cell.PutValue("Hello World!"); | |
wkb.Save("modified-targetfile.xlsx"); |
Explore File Editor Options with .NET
What is XLSX File Format?
The XLSX file format is a widely used file format for storing spreadsheet data in Microsoft Excel. It is the default and standard format for Excel workbooks in recent versions of the software.XLSX files are designed to store data in a structured and efficient manner. They utilize the Open XML format, which is an open standard for storing and manipulating office documents. This format offers several advantages, including smaller file sizes and improved data recovery capabilities.
With XLSX files, users can create, edit, and analyze data in Excel with a wide range of features and functionalities. The format supports various types of data, such as numbers, text, formulas, charts, and formatting options. It also allows for the creation of multiple worksheets within a single workbook, providing organization and flexibility for complex data sets.
One of the significant benefits of the XLSX format is its compatibility with different platforms and software applications. XLSX files can be opened and edited not only in Microsoft Excel but also in other spreadsheet programs like Google Sheets, LibreOffice Calc, and Apple Numbers. This makes it easier to collaborate and share data across different platforms and software environments.
Furthermore, XLSX files offer robust data protection and security features. Users can apply passwords to restrict access to the workbook or specific worksheets, ensuring the confidentiality and integrity of sensitive information.