CodeIgniter Forums
Convert CSV to EXCEL - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Convert CSV to EXCEL (/showthread.php?tid=41561)



Convert CSV to EXCEL - El Forum - 05-11-2011

[eluser]Sudz[/eluser]
how to convert csv to excel in php.
Any example please reply.


Convert CSV to EXCEL - El Forum - 05-11-2011

[eluser]InsiteFX[/eluser]
Convert csv to xls (excel) in php

InsiteFX


Convert CSV to EXCEL - El Forum - 05-11-2011

[eluser]Sudz[/eluser]
I have refer the tutorial you suggested
but it is not working i got this notice
Code:
Notice: Undefined index: path in excel.php on line 75

Notice: Undefined variable: size in excel.php on line 163

Here is my code
Code:
$fp = fopen("xlsfile://example.xls", "wb");
if (!is_resource($fp))
{
    die("Cannot open $export_file");
}
// typically this will be generated/read from a database table
$assoc = array(
    array("Sales Person" => "Sam Jackson", "Q1" => "$3255", "Q2" => "$3167", "Q3" => 3245, "Q4" => 3943),
    array("Sales Person" => "Jim Brown", "Q1" => "$2580", "Q2" => "$2677", "Q3" => 3225, "Q4" => 3410),
    array("Sales Person" => "John Hancock", "Q1" => "$9367", "Q2" => "$9875", "Q3" => 9544, "Q4" => 10255),
        );
            
fwrite($fp, serialize($assoc));
fclose($fp);



Convert CSV to EXCEL - El Forum - 05-11-2011

[eluser]InsiteFX[/eluser]
You might be able to use this, rename it excel_helper and place in the application/helpers folder.
Excel Plugin

InsiteFX