PHP code example of lazuli / vsxlsx

1. Go to this page and download the library: Download lazuli/vsxlsx 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/ */

    

lazuli / vsxlsx example snippets




$parser = new VSXLSX\Parser($filename, /*sheet number */);

if ($parser->parse()) {
	// Returns an array
	$parsed = $parser->get_parsed();
	/* Do something with the parsed array */
} else {
	foreach($parser->get_errors() as $error) {
		echo "Error: $error\n";
	}
}

	$column_names = array();

	// Any of these will override the first column's title
	$column_names[0] = 'product_title';
	$column_names['a'] = 'product_title';
	$column_names['A'] = 'product_title';

	// This will add a title for the 27th column (index 26)
	$column_names['aa'] = 'image_url';

	$parser->header_names($column_names);

	$parser->has_header_row(false);