Vendor/phpspreadsheet/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx.php
public function listWorksheetNames($pFilename)
    {
        File::assertFile($pFilename);

        $worksheetNames = [];

        $zip = new ZipArchive();
        $zip->open($pFilename);

        //    The files we're looking at here are small enough that simpleXML is more efficient than XMLReader
        $rels = simplexml_load_string(
            $this->securityScan($this->getFromZipArchive($zip, '_rels/.rels'))
        ); //~ http://schemas.openxmlformats.org/package/2006/relationships");
        foreach ($rels->Relationship as $rel) {
            switch ($rel['Type']) {
                case 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument':
                    $xmlWorkbook = simplexml_load_string(
                        $this->securityScan($this->getFromZipArchive($zip, "{$rel['Target']}"))
                    ); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"

                    if ($xmlWorkbook->sheets) {
                        foreach ($xmlWorkbook->sheets->sheet as $eleSheet) {
                            // Check if sheet should be skipped
                            $worksheetNames[] = (string) $eleSheet['name'];
                        }
                    }
            }
        }

        $zip->close();

        return $worksheetNames;
    }
public function listWorksheetNames($pFilename)
    {
        File::assertFile($pFilename);

        $worksheetNames = [];

        $zip = new ZipArchive();
        $zip->open($pFilename);

        //    The files we're looking at here are small enough that simpleXML is more efficient than XMLReader
        $rels = simplexml_load_string(
            $this->securityScan($this->getFromZipArchive($zip, '_rels/.rels'))
        ); //~ http://schemas.openxmlformats.org/package/2006/relationships");
        foreach ($rels->Relationship as $rel) {
            switch ($rel['Type']) {
                case 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument':
                    $xmlWorkbook = simplexml_load_string(
                        $this->securityScan($this->getFromZipArchive($zip, "{$rel['Target']}"))
                    ); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"

                    if ($xmlWorkbook->sheets) {
                        foreach ($xmlWorkbook->sheets->sheet as $eleSheet) {
                            // Check if sheet should be skipped
                            $worksheetNames[] = (string) $eleSheet['name'];
                        }
                    }
            }
        }

        $zip->close();

        return $worksheetNames;
    }
public function listWorksheetNames ( $ pFilename ) { File :: assertFile ( $ pFilename ) ; $ worksheetNames = [ ] ; $ zip = new ZipArchive ( ) ; $ zip -> open ( $ pFilename ) ; //    The files we're looking at here are small enough that simpleXML is more efficient than XMLReader $ rels = simplexml_load_string ( $ this -> securityScan ( $ this -> getFromZipArchive ( $ zip , '_rels/.rels' ) ) ) ; //~ http://schemas.openxmlformats.org/package/2006/relationships"); foreach ( $ rels -> Relationship as $ rel ) { switch ( $ rel [ 'Type' ] ) { case 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument' : $ xmlWorkbook = simplexml_load_string ( $ this -> securityScan ( $ this -> getFromZipArchive ( $ zip , "{$rel['Target']}" ) ) ) ; //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main" if ( $ xmlWorkbook -> sheets ) { foreach ( $ xmlWorkbook -> sheets -> sheet as $ eleSheet ) { // Check if sheet should be skipped $ worksheetNames [ ] = ( string ) $ eleSheet [ 'name' ] ; } } } } $ zip -> close ( ) ; return $ worksheetNames ; }
Reads names of the worksheets from a file, without parsing the whole file to a Spreadsheet object.

@param string $pFilename

@throws Exception

@return array
Reads names of the worksheets from a file without parsing the whole file to a Spreadsheet object .