Tag Archives: php

How can I replicate the Excel FV function in PHP?

Questions: I’m converting some rather complex calculations from an Excel spreadsheet, to PHP. I’m stuck on the conversion of Excel’s FV function, which is defined thusly: FV( interest_rate, number_payments, payment, PV, Type ) I’ve been working on this for 2 hours now, and there has to be something I’m missing. Essentially, I need to replicate… Read More »

PHPExcel Reader Date Format Issue – rangeToArray

Questions: I am facing a Date format issue when reading excel using PHPExcel. Even I used $objReader->setReadDataOnly(false); getting format of the cell but not working for me. This how I am reading the data from Excel. $get_excel_data = $objPHPExcel->getActiveSheet()->rangeToArray(“A1:”.$highestColumn.$highestRow); When I am trying to print date, it shows like 03/06/13, and I have tried to… Read More »

Read Date Format in PHP EXCEL

Questions: I have read excel file using PHP excel . But that excel file contain some date (time format) PHP excel return wrong values for that case My code is in below enter code hereinclude ‘Classes/PHPExcel/IOFactory.php’; $inputFileName = ‘index.xlsx’; // Read your Excel workbook try { $inputFileType = PHPExcel_IOFactory::identify($inputFileName); $objReader = PHPExcel_IOFactory::createReader($inputFileType); $objPHPExcel = $objReader->load($inputFileName);… Read More »

PHP Excel, but no Spreadsheet_Excel_Writer

Questions: I need to save some data in .xls file. I am trying to use PEAR library Spreadsheet_Excel_Writer. It is work. But now i am working with hosting without PEAR. Of cause, it is very terrible. Spreadsheet_Excel_Writer has a lot of dependencies. I need a module or code, which i can include in my scripts.… Read More »

PHP to MySql to CSV to Excel UTF-8

Questions: I know this has been discussed several times but yet I’m getting crazy dealing with this problem. I have a form with a submit.php action. At first I didn’t change anything about the charsets, I didn’t use any utf8 header information.. The result was that I could read all the ä,ö,ü etc correctly inside… Read More »

Creating Multiple Excel Sheets using Pure PHP – Possible?

Questions: At present I’m storing data in a variable which contains HTML table. I got this idea from How to format excel file with styles, fonts, colors, tables etc with pure PHP? $table = ‘<table>’; $table .= ‘<tr>’; $table .= ‘<td>1st row, 1st cell</td>’; $table .= ‘<td>1st row, 2nd cell</td>’; $table .= ‘</tr>’; $table .=… Read More »

PHPExcel not display all rows using php

Questions: In excel sheet, I cannot display all rows of table.My following code display only first row. $sql=”SELECT * FROM projects”; $result=mysqli_query($con,$sql); $row = 1; while($row_data = $result->fetch_assoc()) { $col = 0; foreach($row_data as $key=>$value) { $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($col, $row, $value); $col++; } $row++; } Answers: TRY THIS,CHANGE ROW AND COL VARIABLE $sql=”SELECT * FROM projects”; $result=mysqli_query($con,$sql);… Read More »

Excel to PDF conversion in PHP

Questions: It is asked to me to do a small excel to pdf conversion. Let me describe what is exactly to be done. in excel file there are list of companies which looks like this… and to retrieve a company name turn into this in PDF format, like this… I am thinking to follow a… Read More »

Upload a .csv file into PHP MySQL database without column headings

Questions: I want to upload .csv files into MySQL database using PHP. I have this code: <?php include_once ‘db.php’; if(isset($_POST[‘submit’])){ if($_FILES[‘csv_data’][‘name’]){ $arrFileName = explode(‘.’,$_FILES[‘csv_data’][‘name’]); if($arrFileName[1] == ‘csv’){ $handle = fopen($_FILES[‘csv_data’][‘tmp_name’], “r”); while (($data = fgetcsv($handle, 1000, “,”)) !== FALSE) { $item1 = mysqli_real_escape_string($dbConnection,$data[0]); $item2 = mysqli_real_escape_string($dbConnection,$data[1]); $import=”INSERT into tbl_csv values(”,’$item1′,’$item2′)”; mysqli_query($dbConnection,$import); } fclose($handle); print “Import… Read More »

PHP – import data into a excel template

Questions: first off I am fairly new to php like 3 weeks working with it, and am loving it so far. Its a fantastic language. I am running into a issue though, I have a client who wants the information collected in on a form on this website to then be imported into a excel… Read More »