Unable to load the excel sheet containing formulas

Topics: Developer Forum, Project Management Forum, User Forum
Oct 5, 2009 at 1:04 PM
Edited Oct 5, 2009 at 1:12 PM

Hi ,

I am unable to the xlsx or xls file containing formulas with the following code snippet. The xls file contains multiple sheets upto 10 sheets with formulas in it. please suggest me in this regard. i have tried with excel5 class also .....

error_reporting(E_ALL);

/** PHPExcel_IOFactory */
require_once '../Classes/PHPExcel/IOFactory.php';

if (!file_exists("Golf1.xlsx")) {
	exit("Please run 05featuredemo.php first.\n");
}

echo date('H:i:s') . " Load from Excel2007 file\n";
$objPHPExcel = PHPExcel_IOFactory::load("Golf1.xlsx");

echo date('H:i:s') . " Write to Excel2007 format\n";
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));


// Echo memory peak usage
echo date('H:i:s') . " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB\r\n";

// Echo done
echo date('H:i:s') . " Done writing files.\r\n";
///For Excel5 the code snippet
<?php

require_once '../Classes/PHPExcel/IOFactory.php';
require_once '../Classes/PHPExcel/Reader/Excel2007.php';
require_once '../Classes/PHPExcel/Reader/Excel5.php';
require_once '../Classes/PHPExcel/Writer/Excel5.php';

echo date('H:i:s') . " Load from Excel2007 file\n";
$objReader = new PHPExcel_Reader_Excel5();
$objReader->setReadDataOnly(true);
$objReader->setLoadAllSheets();
$objPHPExcel = $objReader->load("Golf1.xls");

$objPHPExcel->setActiveSheetIndex(0)
             ->setCellValue('A1', 'test');

$objWriter = new PHPExcel_Writer_Excel5($objPHPExcel);
$objWriter->save("Test.xls");
?>


Developer
Oct 6, 2009 at 1:48 AM

Are you getting any error messages? What is the result of the above code?

Can you upload the files Golf1.xlsx, or Golf1.xls somewhere so we can test? Alternatively, you can send the files to me: (erik at phpexcel dot net)

Oct 6, 2009 at 10:20 AM
Edited Oct 6, 2009 at 1:05 PM
Hi Koyama,
 
The browser is showing the process bar for some time and Displaying Cannot Display page. I have tried the with the uploaded excel file below.
xls:
xlsx
On Tue, Oct 6, 2009 at 7:18 AM, koyama <notifications@codeplex.com> wrote:

From: koyama

Are you getting any error messages? What is the result of the above code?

Can you upload the files Golf1.xlsx, or Golf1.xls somewhere so we can test? Alternatively, you can send the files to me: (erik at phpexcel dot net)

Read the full discussion online.

To add a post to this discussion, reply to this email (PHPExcel@discussions.codeplex.com)

To start a new discussion for this project, email PHPExcel@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

 

Developer
Oct 7, 2009 at 3:33 AM

I can verify the issue. Initial tests indicate that the problem may have to do with absolute 3D cell references when they appear as arguments in functions. The Excel5 formula parser is buggy, but I didn't know it couldn't handle this. For example, it doesn't seem to handle this kind of formula:

=SUM(Sheet!$A$1)

Will need to do more testing later this week.

Oct 7, 2009 at 12:47 PM

Thanks for the update. Request  you to please accomplish this as soon as possible.

Developer
Oct 13, 2009 at 5:44 PM

Posting this in the issue tracker. I hope it is something we can fix.

http://phpexcel.codeplex.com/WorkItem/View.aspx?WorkItemId=10757