Tag: php

PHPExcel generating corrupted file – ob_end_clean() not working

I’m trying to generate a .xlsx file using PHPExcel. The process is generating the file, but when I’m getting to open the file, It says It’s corrupted. When I use Open and Repair, the file opens and It’s ok, but I don’t want to repair everytime I generate the file. I tried to use the […]

format an excel column to accept date in particular format only phpExcel

I am generating an excel sheet via phpExcel in which dates are retrieved in 01-JAN-1900 format.But I want it to be visible in DD-MM-YYYY format right from when the excel sheet is generated with default date values fetched from DB.Also the date format is DD-MM-YYYY in DB.So how can we format that cell to display […]

Embedding VBA code in Excel using PHP

We want to embed macro code in excel sheet using php. We are using PHPExcel to generate a excel workbook, which is successfully generated. Now we just want to embed macro code in this excelsheet.

Php – Read Excel and Strore to Db

error_reporting(E_ALL); ini_set(‘display_errors’, TRUE); ini_set(‘display_startup_errors’, TRUE); $inputFileName =”../brief/phaseupload/” . $filename; // Read your Excel workbook try { $inputFileType = PHPExcel_IOFactory::identify($inputFileName); $objReader = PHPExcel_IOFactory::createReader($inputFileType); $objPHPExcel = $objReader->load($inputFileName); } catch(Exception $e) { die(‘Error loading file “‘.pathinfo($inputFileName,PATHINFO_BASENAME).'”: ‘.$e->getMessage()); } // Get worksheet dimensions $sheet = $objPHPExcel->getSheet(0); $highestRow = $sheet->getHighestRow(); $highestColumn = $sheet->getHighestColumn(); // Loop through each row of the […]

Exporedt mysql data not display in Excel sheet format

I am using given below code to export database data in to excel sheet,But data in export properly & HTML code also display $Year=”15″; $sql = “select * from table WHERE CurYear=$Year ORDER BY id”; $header = ”; $data =”; $export = mysql_query($sql) or die(mysql_error($con)); while ($fieldinfo=mysql_fetch_field($export)){ $header .= $fieldinfo->name.”\t”; } while( $row = mysql_fetch_row( […]

PHP: Fatal Error while trying to load Excel Object

I’m using php to open an excel file. I want my excel file to be visible on the clients side. Just to open it. Im still working on my local host so it cant be an IIS setting error, as mentioned in other stack answers. I created a VB macro called OpenWorkbook, which finds the […]

Multidimensional Array with PHPExcel

I am trying to export a multidimensional array as excell file using phpexcel librery. Somehow i cant get beyond exporting a file with the groupname in columne’s. My code: $arr = array( “group1″=>array( 1001 => array( “name”=>”Product 1”, “desc”=>”lorem ipsum”, “star”=>”3”, “price”=>”15” ), 1002 => array( “name”=>”Pedruzka”, “desc”=>”Speck, Zwiebeln”, “star”=>”2”, “price”=>”17” ) ), “group2″=>array( 1001 […]

format excel sheet using php

I am trying to download a report using php from database. I am successful in getting the data but I am stuck at formatting the cells. Can any one guide me how to format Excel? I cannot use any 3rd party plugin like PHPExcel or Spread Sheet Writer. I tried concatenating html code in php, […]

Complex reporting PHP MySQL

I have four tables in my Database: Metrics ->id ->description Agents ->id ->name Forms ->id ->agent_id ->campaign_id ->calldatetime ->phone Forms_Responses ->id ->form_id ->metrics_id ->response And one of the users asked me make a report like so: Metric ID | Agent_name | Agent_name | Agent_name .. and so on (depends how many from db) __________|____________|____________|______________ | […]

export selected mysql data to excel

I have a question about exporting selected mysql data to excel. I have pulled data from a mysql table and I arranged it as I wanted. How can I export data from current page to excel?? I have tried to use this code, <input type= “button” onclick=location.href=”export.php” value=”Export”/> this is for the export button on […]

MS Excel Spreadsheet is the best Office Software, Excel VBA and Excel Formulas make Spreadsheet work faster.