Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- array(9) { [0]=> string(1) "1" [1]=> string(24) "Company" [2]=> string(9) " 12345689" [3]=> string(9) "Name" [4]=> string(1) "4" [5]=> string(26) "careerintern2017@gmail.com"}
- id | ent_name | ent_num | owner | ent_c | email
- -------------------------------------------------------------------------
- 1 | Company | 123456789| Name | 4 | careerintern2017@gmail.com
- -------------------------------------------------------------------------
- $excel_file_path = "ent_info/ent_info_list.xlsx";
- $spreadsheet = PhpOfficePhpSpreadsheetIOFactory::load($excel_file_path);
- $row_num = $spreadsheet->setActiveSheetIndex(0)->getHighestRow();
- $row_num =$row_num+1;
- $col_num=0;
- $counter=1;
- $sheet = $spreadsheet->getActiveSheet();
- foreach($array as $data){
- $pos = get_excel_col($col_num).$row_num;
- //$pos = A2, B2, C2 .... (for example)
- $sheet->setCellValue($pos, $data);
- if($counter==6){
- $row_num++;
- $col_num=0;
- }
- $col_num++;
- $counter++;
- }
- $writer = PhpOfficePhpSpreadsheetIOFactory::createWriter($spreadsheet, "Xlsx");
- $writer->save($excel_file_path);
Add Comment
Please, Sign In to add comment