PHP code example of shuchkin / simplexls

1. Go to this page and download the library: Download shuchkin/simplexls library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

shuchkin / simplexls example snippets


if ( $xls = SimpleXLS::parseFile('book.xls') ) {
	print_r( $xls->rows() );
	// echo $xls->toHTML();	
} else {
	echo SimpleXLS::parseError();
}

echo SimpleXLS::parse('book.xls')->toHTML();

if ( $xls = SimpleXLS::parse('book.xls') ) {
	echo '<table border="1" cellpadding="3" style="border-collapse: collapse">';
	foreach( $xls->rows() as $r ) {
		echo '<tr><td>'.implode('</td><td>', $r ).'</td></tr>';
	}
	echo '</table>';
} else {
	echo SimpleXLS::parseError();
}

if ( $xls = SimpleXLS::parseFile('book.xls') ) {
  print_r( $xls->sheetNames() );
  print_r( $xls->sheetName( $xls->activeSheet ) );
}

if ( $xls = SimpleXLS::parseFile('book.xls') ) {
  print_r( $xls->boundsheets ); 
}

$xls = new SimpleXLS('books.xls');
if ($xls->success()) {
	print_r( $xls->rows() );
} else {
	echo 'xls error: '.$xls->error();
}

ini_set('error_reporting', E_ALL );
ini_set('display_errors', 1 );

//header('Content-Type: text/html; charset=utf-8');

$xls = SimpleXLSX::parse('books.xls', false, true );
print_r( $xls->rows() );
print_r( $xls->sheets );