Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excel to Csv #153

Open
GoogleCodeExporter opened this issue Jul 24, 2015 · 0 comments
Open

Excel to Csv #153

GoogleCodeExporter opened this issue Jul 24, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

my script don't work when i save the CSV file
please help me
<?php
require_once 'Excel/reader.php';
$data = new Spreadsheet_Excel_Reader();
$data->setOutputEncoding('CP1251'); // Set output Encoding.
$data->read('prodotti.xls');
error_reporting(E_ALL ^ E_NOTICE);


echo "<table border='1'>";
      //ciclo su tutte le righe
for ($i = 1; $i <= $data->sheets[0]['numRows']; $i++) {
        echo "<tr>";
        //ciclo sulla prima colonna 
    for ($j = 1; $j <= 1; $j++) {
        echo "<td>".$data->sheets[0]['cells'][$i][$j]."</td>";
    }

            //ciclo sulla quarta colonna 
           for ($j = 4; $j <= 4; $j++) {
              echo "<td>".$data->sheets[0]['cells'][$i][$j]."</td>";

           }
    echo "</tr>";

}
echo "</table>";
                $csv = "";
                $rows = $data->rowcount();
                $cols = $data->colcount();
                $csv .= $data->raw($i, $j);
                   if($j == $cols - 1) {
                         $csv .= "\n";
                    } else {
                    $csv .= ",";
                            }  

        $handler = fopen("test1.csv", "w");
        fwrite($csv, $handler);
        fclose($handler); 
?>

Original issue reported on code.google.com by [email protected] on 24 Aug 2012 at 10:36

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant