Viewed   200 times

I'm trying to read an Excel file (Office 2003). There is an Excel file that needs to be uploaded and its contents parsed.

Via Google, I can only find answers to these related (and insufficient topics): generating Excel files, reading Excel XML files, reading Excel CSV files, or incomplete abandoned projects. I own Office 2003 so if I need any files from there, they are available. It's installed on my box but isn't and can't be installed on my shared host.

Edit: so far all answers point to PHP-ExcelReader and/or this additional article about how to use it.



I use PHP-ExcelReader to read xls files, and works great.

Saturday, August 27, 2022

Filesize isn't a good measure when using PHPExcel, it's more important to get some idea of the number of cells (rowsxcolumns) in each worksheet.

If you have no need for styling, are you calling:


before loading the file?

If you don't need to access all worksheets, or only certain cells within a worksheet, look at using




or defining a readFilter

Are you using cell caching? If so, what method? That slows down the load time.

Thursday, August 25, 2022

There is a microsoft knowledge base article that lays out all the ways this is possible.

I think using OPENROWSET or OPENDATASOURCE will be the easiest way, without the wizard. (see Distributed Queries)

'Excel 8.0;Database=C:testxltest.xls', [Customers$])

See OPENROWSET documentation, with examples lower down the page.


Right click on the database name/go to task and then select import data, as a source select an excel file that you created before and choose it's path on the next page select sql server as destination

Monday, November 7, 2022

Importing from Excel files (XLS) is way harder than improting from CSV files. Usually I save my XLS to CSV with Excel then work on this CSV with PHP...

Look at PHP function fgetcsv at:

$row = 1;
if (($handle = fopen("test.csv", "r")) !== FALSE) {
    while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
        $num = count($data);
        echo "<p> $num fields in line $row: <br /></p>n";
        for ($c=0; $c < $num; $c++) {
            echo $data[$c] . "<br />n";

If you still want to load XLS directly from PHP it's possible (but how reliable)... A quick seach resulted in which might be helpful.

Monday, August 8, 2022

Check the first examples here:

What often goes wrong is that Excel will estimate the type of a column based upon the first X rows. When after that the values don't match, these rows get empty values. I'm afraid that going into the registry is sometime the only way to get the Excel driver to scan all rows first (as described in the article).

Play around with the HDR and IMEX settings in your environment. In some cases that will help as well.

Thursday, September 8, 2022
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :