import spreadsheet with text format

Topics: Developer Forum, User Forum
Nov 13, 2014 at 3:52 PM
Hello guys,
how to import a spreadsheet in text format, my code
$file_tmp = $_FILES['arquivo']['tmp_name'];

try {
    $FileType = PHPExcel_IOFactory::identify( $file_tmp ); 
    $objReader = PHPExcel_IOFactory::createReader( $FileType ); 
    $objReader->setReadDataOnly( true );
    $objPHPExcel = $objReader->load( $file_tmp );   
}catch( Exception $e ){
    die( $e->getMessage() );
}

$objWorksheet = $objPHPExcel->getActiveSheet();
$fimColuna = $objWorksheet->getHighestColumn();
$numero_de_linhas = $objWorksheet->getHighestRow();
$numero_de_colunas = PHPExcel_Cell::columnIndexFromString( $fimColuna );

for( $row = 0; $row <= $numero_de_linhas; $row++ ){
    $data = array();
    for( $col = 0; $col < $numero_de_colunas; $col++ ){     
        $data[] = $objWorksheet->getCellByColumnAndRow($col, $row)->getValue();
    }
}
dates in the format 12/11/2014 MONTH/DAY/YEAR, are thus 41984.69211805556

Thank you in advance for your help.
Nov 20, 2014 at 5:42 AM
Instead of getValue() try getCalculatedValue() or getFormattedValue()

At least I think that what the other to types are called.

getFormattedValue() should give you your dates in mm/dd/yyyy format or whatever format the spreadsheet has specified for that cell/column.

-- Christopher Mullins