I need to import the data from excel…
Can anyone help me…?
Thanks in advance
I need to import the data from excel…
Can anyone help me…?
Thanks in advance
Google-ing “php xls reader” i’ve found this:
php-excel-reader
This may solve your problem.
An alternative could be PHPExcel
Regards,
D
I use this script to import csv file:
<?php
ini_set('memory_limit', '128');
ini_set('max_execution_time', '1100');
require_once('con.php');
$nome_temporario=$_FILES["arquivo"]["tmp_name"];
$nome_arquivo = "filename.csv";
copy($nome_temporario,"importa/$nome_arquivo");
//========================================
$tabela = "tb_base_indicadores";
$arquivo = 'Base_Indicadores.csv';
$arq = fopen("importa/file.csv", "r");
while(!feof($arq))
for($i=0; $i<1; $i++){
if ($conteudo = fgets($arq)){
$ll++;
$linha = explode(';', $conteudo);
}
$sql = "INSERT INTO $tabela (mes, id_local, id_indicador, id_conta, valor_meta, valor_real, valor_real_ano_anterior) VALUES ('$linha[0]', '$linha[1]', '$linha[2]','$linha[3]', '$linha[4]', '$linha[5]', '$linha[6]')";
$result = mysql_query($sql) or die(mysql_error());
$linha = array();
}
echo "quantidade de linhas importadas = ".$ll;
?>
[size="6"]wow, great way.
thank you[/size]