Welcome Guest, Not a member yet? Register   Sign In
Extract excel data using php
#8

[eluser]MASS MASS[/eluser]
First thing i am taking uploaded file from users when upload the excel file ...
this is for upload file

$config['upload_path'] = './system/application/views/';
$config['allowed_types'] = 'xls';
$config['max_size']= '5000';
$config['max_width']= '2000';
$config['max_height']= '2000';
$this->load->library('upload', $config);
$this->upload->do_upload();
$file_upload = $this->upload->data();
$userfile = $file_upload['file_name'];
$arr_data['filename'] = $userfile;
$this->load->view('excel',$arr_data);

then i am using reader.php class to extract (view page)

$data = new Spreadsheet_Excel_Reader();
//print_r($data);

$data->setOutputEncoding('CP1251');


$data->read($filename);
error_reporting(E_ALL ^ E_NOTICE);

$total_row = $data->sheets[0]['numRows'];


$startRow = 1;
$cells = $data->sheets[0]['cells'];

echo "<table border='1' style='font-size:14px;font-family:Arial;'>
<tr><td align=center>email_id</td><td align=center>First Name</td><td align=center>lastname</td></tr>";

for ($row = $startRow;$row <= $total_row;$row++)
{
$email = $cells[$row][1];
$first_name = $cells[$row][2];
$last_name = $cells[$row][3];

/* Then display them */
echo "<tr><td>" . $email . "</td>";
echo "<td>" . $first_name . "</td>";
echo "<td>" . $last_name . "</td></tr>";

}

echo "</table>";


question is while uploading file whether i have to give permission to that xls file ......is it possible


Messages In This Thread
Extract excel data using php - by El Forum - 10-22-2007, 03:05 AM
Extract excel data using php - by El Forum - 10-22-2007, 04:27 AM
Extract excel data using php - by El Forum - 10-22-2007, 04:36 AM
Extract excel data using php - by El Forum - 10-23-2007, 12:49 AM
Extract excel data using php - by El Forum - 10-23-2007, 12:56 AM
Extract excel data using php - by El Forum - 10-23-2007, 01:04 AM
Extract excel data using php - by El Forum - 10-23-2007, 01:20 AM
Extract excel data using php - by El Forum - 10-23-2007, 01:41 AM
Extract excel data using php - by El Forum - 10-23-2007, 02:21 AM
Extract excel data using php - by El Forum - 10-23-2007, 04:01 AM
Extract excel data using php - by El Forum - 10-23-2007, 04:27 AM
Extract excel data using php - by El Forum - 10-23-2007, 04:36 AM
Extract excel data using php - by El Forum - 10-23-2007, 04:52 AM



Theme © iAndrew 2016 - Forum software by © MyBB