Opening Files in PHP

Aspose.Cells - Simple Ways to Open Excel Files

Opening through Path

Simply open a Microsoft Excel file by referencing the file’s path.

PHP Code

$dataDir = '';

$workbook1 = new Workbook($dataDir . "Book1.xls");

Opening through Stream

Sometimes, the Excel file that you want to open is stored as a stream. In that case, use an overloaded version of the Open method that takes a Stream object containing the Excel file.

PHP Code

$fstream = new FileInputStream($dataDir . "Book2.xls");

// Creating a Workbook object with the stream object
$workbook2 = new Workbook($fstream);

$fstream->close();

Download Sample Code

Download Opening Files (Aspose.Cells) from any of the social coding sites mentioned below: