I have a PHP script which exports data from database to different formats, including as an Excel document. If a text field contains such a value as 123123123123
, Excel, by default converts it to 1.23123E+11
. Is it possible to prevent this absolutely unnecessary behaviour?
Excel Tactics
If your goal is to store the number as text (and not do math on it later) and the PHP is exporting as a CSV, a simple solution would be to export the number as a CONCATENATE
function.
=CONCATENATE(123123123123)
renders as 123123123123
in text format when the CSV is opened in Excel (this is for Excel 2010).
来源:https://stackoverflow.com/questions/18816995/prevent-excel-from-reformatting-text-in-the-scientific-notation