faisalman / simple-excel-php

Simplexcel.php - Easily read / parse / convert / write between Microsoft Excel XML / CSV / TSV / HTML / JSON / etc spreadsheet tabular file formats
http://faisalman.github.io/simple-excel-php
562 stars 146 forks source link

Class 'SimpleExcel' not found #53

Closed Bert-de-Jong closed 5 years ago

Bert-de-Jong commented 6 years ago

I'm running into the same problem as mentioned by Nevega on linux.org.ru here. Namely an error "Class 'SimpleExcel' not found".

<?php
  error_reporting (-1);
  ini_set ('display_errors', 'On');
  include_once (dirname (__FILE__) . '/../lib/SimpleExcel/SimpleExcel.php');
  $excel = new SimpleExcel ('xml');
?>

The include works, but then the new fails.

guyilherme commented 5 years ago

I have the same problem

cfoellmann commented 5 years ago

You need

use SimpleExcel\SimpleExcel;

because the class is in its own namespace

Bert-de-Jong commented 5 years ago

You need

use SimpleExcel\SimpleExcel;

because the class is in its own namespace

Going by the examples for 0.3.x and 0.4.x, what you write is correct. Even the README mentions it. I have no idea why I didn't include the use statement. Maybe the documentation has changed or is now more easily accessible, or something. I already switched to PhpSpreadsheet since I created this issue (ticket/thread), so I cannot check my code to see what I was trying to do at the time. I'm closing this issue.

cfoellmann commented 5 years ago

I just started using PhpSpreadsheet myself. Working wiht an xls as a "database" is a real pain. but a requirement in my case