In this example, we will explore how to edit Excel file in C++. You can edit Excel file programmatically in C++ using simple API interface that can be used both in Microsoft Windows and Linux etc.
Steps to Edit Excel File in C++
- Add Aspose.Cells.Cpp with NuGet package Manager tool
- Add a reference to Aspose::Cells namespace
- Create instance of Workbook object to load Excel file for editing
- Access the cells A1 and C1 inside worksheet and set data and formula string respectively
- Calculate the formula for Workbook
- Save the output workbook with formula to XLSX in C++
The following example is used to access the workbook and update Excel file in C++ very quickly and easily using few API calls. Using C++, you can set any content data to Excel cells programmatically like Date, Percentage, Numeric or any other value.
Code to Edit Excel File in C++
This entire process of editing Excel file in C++ is achieved with no dependence on Microsoft Office or Interop. At this point, if you even want to save the Excel file as PDF, you can explore example How to Convert Excel to PDF using C++.