Add whitespace to CSV number in PHP -
i have system takes excel file, manipulation , exports csv file ready import else.
everything works except numbers; when csv file import final system numbers show 1e+11 example.
i have previous csv file works , difference can see when open in notepad there whitespace after number e.g
123456643567 ,872871643567 ,465435654356
whereas new file doesn't have whitespace after number e.g
123456643567,872871643567,465435654356
this difference can see can presume causing problem, don't know how add white space in. if try , append whitespace end numbers surrounded speech marks , still doesn't work e.g
"123456643567 ","872871643567 ","465435654356 "
is there way add in or there else @ work causing issue?
edit:
for reference, below code have read in excel file using phpexcel:
// identify type of $file $file_type = phpexcel_iofactory::identify($file); // create new reader of type has been identified $reader = phpexcel_iofactory::createreader($file_type); // load $file phpexcel object $obj = $reader->load($file); // load file rowiterator $rows = $obj->getactivesheet()->getrowiterator(); // create array $excel_array = array(); foreach($rows $row){ $cells = $row->getcelliterator(); $index = $row->getrowindex (); // check row contains data if($index>=$req_array[$req][0]){ foreach ($cells $cell) { $column = $cell->getcolumn(); // check column needed if(strpos($req_array[$req][1],'|'.$column.'|')!==false){ $excel_array[$index][$column] = $cell->getcalculatedvalue(); } } } } // return array return $excel_array;
the req_array includes string of required columns , row start on.
Comments
Post a Comment