CI Export CSV data formating issue - php

I'm learning PHP & CodeIgniter 3. In this project I need to export some data to a CSV file. I'm able to export the CSV file, however the data is displaying incorrectly in a couple columns. Example (5.32856E+11) where it should be (532856165001). I'm able to see the actual value if you double click the cell.
Is there anyway to force the data in a CSV to display the data correctly?

This is the microsoft excel formatting and does not have any relation with your code just try to regenerate your csv and then re-open your file with a simple text editor (notepad++ or sublim text)

Related

Extracting BLOB data from Excel with PHP

I have an excel with data exported from one MSSQL database.
I want to get the data out of this file. The filereading is easy, everyone could do it, but is there any special work I have to de around the BLOB field to take it out safe and put it in a file.
This field contains either a HTML or a RTF file (i have another field which tells me if it is HTML or RTF).

how to read and write excel file from browser and then updating the values to the database

i have a html dynamic html table, i want to download this table as excel file.And after downloading i could make some changes in it and again upload it to a folder where it would change the database data according to fields..I was able to download the html table to an excel file, but have no idea how after changing the contents in the excel file would update the database according to it.I have heard of tongue twisters but this nerve twisting.
You may want to take a look at the PHPExcel library, available at phpexcel.codeplex.com.
If you want to do this with JS (I not recommend) you could copy/paste the excel content to a textarea in your HTML and then with JS you can do:
var temp = document.getElementById("yourtextarea").value.split(" ");
Since excel by default separates columns with '(tab)' you can explode it and save in the DB. You will also have to explode the newlines. It could be \r\n or just \n depending on your OS. After doing so, you can commit it to the database, row by row using Ajax.
If you can do it with PHP then would be much more easier. You could you explode() using newline at first (to break lines) and tab at finally (to break columns).

removing duplicates from different Excel files

I am having many excel files in a folder, I have to create a tool to read those files and remove duplicate data between files using PHP and MYSQL.
So that i tried to read the data using Excel reader and store them in database
I was struggling to remove the duplicate fields
And also exporting the remaining data to excel file
Try this it may help you with your duplications http://www.databasejournal.com/features/mysql/article.php/10897_2201621_2/Deleting-Duplicate-Rows-in-a-MySQL-Database.htm
And if you want to import the data using php Click [Here]http://www.programmingfacts.com/export-mysql-data-into-excelcsv-via-php/

HTML table data transfer into MS Excel?

I have a report which is created by PHP getting data from mysql and display in HTML table cells now I just created a button at the bottom of table Transfer in Excel when user click on this button then html data completely transfer in MS Excel.
So how can I do this if anybody have some code, script etc please give me.
You can use the excellent PHP library PHPExcel
you can simply export the data in CSV format, which Excel can import.

Exporting from PHP to Excel - cell formatting

I am exporting data from a database to an Excel file using PHP and a Codeigniter to_excel helper.
Everything is working correctly, except I have a field that contains data in the format of 1-1, 2-1 etc. When I open the file in Excel, Excel is automatically formatting this data as a date field so that it appears 01-Jan, 02-Jan etc.
Is there a way to force Excel not to format this data as a date field?
Thanks.
Preface the data with a single apostrophe so that Excel treats it as text. This needs to be done before it is opened in Excel.

Categories