Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

Previous issue #861 prematurely closed #862

Open
KK4HFJ opened this issue Jan 28, 2022 · 4 comments
Open

Previous issue #861 prematurely closed #862

KK4HFJ opened this issue Jan 28, 2022 · 4 comments

Comments

@KK4HFJ
Copy link

KK4HFJ commented Jan 28, 2022

I had

require_once 'Autoloader/autoload.php';

previously, and it made no difference. I have added it back in, and again, no difference. Are there edits needed?
$srcBaseDirectory =\dirname(\dirname(__FILE__));
hardly looks legitimate?

Still get "This page isn't working"

@adrilo
Copy link
Collaborator

adrilo commented Jan 30, 2022

Just tested, and this works:

<?php

require_once '[PATH_TO_SPOUT]/src/Spout/Autoloader/autoload.php';

use Box\Spout\Reader\Common\Creator\ReaderEntityFactory;

$filePath = '[PATH_TO_FILE]';
$reader = ReaderEntityFactory::createReaderFromFile($filePath);

$reader->open($filePath);

foreach ($reader->getSheetIterator() as $sheet) {
    foreach ($sheet->getRowIterator() as $row) {
        // do stuff with the row
        $cells = $row->getCells();
    }
}

$reader->close();

@KK4HFJ
Copy link
Author

KK4HFJ commented Jan 31, 2022

great. no more errors. now, when I try to retrieve data from the file, nothing happens:

<?php

require_once 'Autoloader/autoload.php';

use Box\Spout\Reader\Common\Creator\ReaderEntityFactory;

$filePath = 'csv/20220127160717 prop.xlsx';
$reader = ReaderEntityFactory::createReaderFromFile($filePath);

$reader->open($filePath);

foreach ($reader->getSheetIterator() as $sheet) {
    foreach ($sheet->getRowIterator() as $row) {
        // do stuff with the row
        $cells = $row->getCells();
		
		$line_num = $cells[1]; 
		
		echo $line_num;
    }
}

$reader->close();

?>

@adrilo
Copy link
Collaborator

adrilo commented Feb 6, 2022

You're reading an XLSX file that's inside a csv folder. Maybe this is not really a XLSX file?
Anyway, the code you're using is correct and should work. The problem must come from the file you're using. Try to check the logs, there should be an error somewhere.

@KK4HFJ
Copy link
Author

KK4HFJ commented Feb 7, 2022 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants