Read Excel File Using PHP library

Import The Library in your file 

include_once('SimpleExcel/SimpleXLSX.php');

use Shuchkin\SimpleXLSX;

ini_set('error_reporting', E_ALL);

ini_set('display_errors', true);

-------------------

 

if(isset($_POST['SOI_Import_File_Submit'])){

            $uploaded_file = $_FILES['SOI_Import_File'];

            $excelFile = file($uploaded_file['tmp_name']);


 

            if ($xlsx = SimpleXLSX::parse($_FILES['SOI_Import_File']['tmp_name'])) {

                echo '<h2>Parsing Result</h2>';

                echo '<table border="1" cellpadding="3" style="border-collapse: collapse; margin-left: 40%;">';

       

                $dim = $xlsx->dimension();

                $cols = $dim[0];

       

                foreach ($xlsx->readRows() as $r_key => $row) {

                    if ($r_key == 0) continue; // skip first row

                    echo '<tr>';

                    for ($i = 0; $i < $cols; $i ++) {

                        echo '<td>' . ( isset($row[ $i ]) ? $r_key.'-'.$i.$row[ $i ] : '&nbsp;' ) . '</td>';

                    }

                    echo '</tr>';

                }

                echo '</table>';

            } else {

                echo SimpleXLSX::parseError();

            }

        }

------------------

See example and details: https://github.com/shuchkin/simplexlsx/tree/master/examples

Write/Export Excel File Using PHP Library

   require_once  get_template_directory() . '/includes/xlsxwriter.class.php';
            $generatedDate = date('d-m-Y His');
            $userdata_file = 'client-data'.$generatedDate.'.xlsx';
 

See More at : https://hotexamples.com/examples/-/XLSXWriter/-/php-xlsxwriter-class-examples.html