Features
Overview
Aspose.Cells FOSS for PHP reads and writes Excel .xlsx workbooks. The feature areas
below are grounded in the library’s confirmed public API (Aspose\Cells_FOSS namespace)
and the examples in this documentation; see Limitations for what is
explicitly out of scope.
Workbook and Worksheet Management
Create a new workbook with new Workbook() or load an existing .xlsx file with
new Workbook($path, $loadOptions). Each workbook exposes a Worksheets collection;
index into it ($workbook->Worksheets[0]) to get a Worksheet, and set its Name.
$workbook = new Workbook();
$sheet = $workbook->Worksheets[0];
$sheet->Name = 'Report';Typed Cell Values and Formulas
Read and write individual cells via $sheet->Cells['A1']. Store a typed value with
Cell::PutValue(), or a formula string via the Cell->Formula property:
$sheet->Cells['A1']->PutValue(12500.75);
$sheet->Cells['B1']->Formula = '=A1*1.1';Aspose.Cells FOSS for PHP does not evaluate formulas — the formula text is stored as-is and recalculated by Excel or another spreadsheet application when the file is opened.
Cell Styling
Read a cell’s current style with Cell::GetStyle(), mutate the returned Style (its
Font, Pattern, and ForegroundColor), then write it back with Cell::SetStyle():
$style = $sheet->Cells['A1']->GetStyle();
$style->Font->IsBold = true;
$style->Font->Color = Color::FromArgb(255, 255, 255, 255);
$sheet->Cells['A1']->SetStyle($style);Save and Load-Time Repair
Workbook::Save($path) writes the workbook as .xlsx. When loading a file of unknown
quality, pass a LoadOptions instance with TryRepairPackage and TryRepairXml set to
true, then check $workbook->LoadDiagnostics->HasDataLossRisk after loading.
Limitations
Aspose.Cells FOSS for PHP does not include a formula calculation engine, PDF/HTML/image export, macro support, or pivot tables. See the product page for the complete, verified capability list.