![]() |
Extract excel data using php - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Extract excel data using php (/showthread.php?tid=3784) Pages:
1
2
|
Extract excel data using php - El Forum - 10-22-2007 [eluser]MASS MASS[/eluser] Is it possible to extract excel(xls extension) data from php and CI....then that will stored in to our database Extract excel data using php - El Forum - 10-22-2007 [eluser]xwero[/eluser] It depends on which kind of xls files you are dealing with, if you have to process older files i would suggest the excel reader library otherwise you can use the excel reader library found on the wiki. They both act the same reading the files, they make an multidimensional array of the xls file. Then it is up to you how to store this array. Extract excel data using php - El Forum - 10-22-2007 [eluser]MASS MASS[/eluser] Thanks for your suggestion .....already i got solution better you go for the below link http://sourceforge.net/project/showfiles.php?group_id=99160&package_id=106368 please download Spreadsheet_Excel_Reader.zip not phpExcelReader.zip its working fine............ Extract excel data using php - El Forum - 10-23-2007 [eluser]MASS MASS[/eluser] again i am facing problem with this class The filename excelfilename.xls is not readable........ Extract excel data using php - El Forum - 10-23-2007 [eluser]xwero[/eluser] How do you read it? I mean what is the code you use to read the xls Extract excel data using php - El Forum - 10-23-2007 [eluser]MASS MASS[/eluser] http://sourceforge.net/project/showfiles.php?group_id=99160&package_id=106368 download from above link --> Spreadsheet_Excel_Reader.zip i am using php code same as in below link .......please refer below link http://www.simonshareef.com/article/reading-ms-excel-files-using-php Extract excel data using php - El Forum - 10-23-2007 [eluser]xwero[/eluser] I never encountered problems using the same code. Try to put the xls file in another directory or check if the file rights are sufficient. Those are the only two things i can think of that would cause this error. Extract excel data using php - El Forum - 10-23-2007 [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 Extract excel data using php - El Forum - 10-23-2007 [eluser]xwero[/eluser] I just wrapped the basic library code of CI around the reader.php file and i call the library like Code: $this->load->library('Excelreader'); In the example code they assume the reader.php file and the xls are in the same directory. Extract excel data using php - El Forum - 10-23-2007 [eluser]MASS MASS[/eluser] $filename variable not a problem .....be'coz if i echo that variable it will display file name correctly......it not a problem code is working properly in case of other excel file .............. only uploaded excel file are not working properly......what's the region |