Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

phpspreadsheet read xlsx

<?php

// include the autoloader, so we can use PhpSpreadsheet
require_once(__DIR__ . '/vendor/autoload.php');

# Create a new Xls Reader
$reader = new PhpOfficePhpSpreadsheetReaderXlsx();

// Tell the reader to only read the data. Ignore formatting etc.
$reader->setReadDataOnly(true);

// Read the spreadsheet file.
$spreadsheet = $reader->load(__DIR__ . '/path/to/file.xlsx');

$sheet = $spreadsheet->getSheet($spreadsheet->getFirstSheetIndex());
$data = $sheet->toArray();

// output the data to the console, so you can see what there is.
die(print_r($data, true));
 
PREVIOUS NEXT
Tagged: #phpspreadsheet #read #xlsx
ADD COMMENT
Topic
Name
9+5 =