0

I am trying to convert a JSON file to CSV using SimpleExcel: https://github.com/faisalman/simple-excel-php

Following the documentation, I created the following PHP file:

    <?

use SimpleExcel\SimpleExcel;

echo "test";

$excel = new SimpleExcel('JSON');
$excel->parser->loadFile('test.json');

echo $excel->parser->getCell(1, 1);

$excel->convertTo('CSV');
$excel->writer->addRow(array('add', 'another', 'row'));
$excel->writer->saveFile('example');

?>

Where test.json is local. For some reason this doesn't work. I was hoping it could create a CSV locally but instead it gives an error:

test Fatal error: Class 'SimpleExcel\SimpleExcel' not found in test.php on line 7

Any tips would be greatly appreciated. Most of their examples focus on converting CSV to XML.

Thanks

1
  • Sorry! Copy and paste issue. I am using ?> Commented Feb 28, 2015 at 17:09

1 Answer 1

1

If you are not autoloading classes, you still need to include/require_once the SimpleExcel source files.

Sign up to request clarification or add additional context in comments.

1 Comment

I've forked and continue develop SimpleExcel github.com/sergeyklay/simple-excel-php. Now SimpleExcel uses Composer autoload

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.