Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Quotes from csv #446

Closed
contifico opened this issue May 22, 2015 · 3 comments
Closed

Remove Quotes from csv #446

contifico opened this issue May 22, 2015 · 3 comments

Comments

@contifico
Copy link

Hi everyone, I get the exported CSV file, but every cell data have quotes.. Can you help me to remove the quotes when export to CSV? here an example:
"20150521","62549","2492","","16.52","1.98","0","0","0","","922330816001","","","P","","2492"
"20150521","71343","2493","","8.26","0.99","0","0","0","","922330816001","","","P","","2493"
I want this..
20150521,62549,2492,,16.52,1.98,0,0,0,,922330816001,,,P,,2492
20150521,71343,2493,,8.26,0.99,0,0,0,,922330816001,,,P,,2493
Thank you

here is my code:

//generating .csv
$csv = Excel::create($conciliacion->nombre, function($excel){
            $excel->sheet('Lista', function($sheet) {
                $empresa = Empresa::find(1);
                $conciliacion = Session::get('conciliacion');
                Session::forget('conciliacion');
                $fecha_conciliacion = $conciliacion->fecha;

                $i = 1;
                $ordenes = Orden::whereBetween('fecha_emision', array($fecha_conciliacion.' 00:00', $fecha_conciliacion.' 23:59'))->get();
                var_dump($ordenes);
                foreach($ordenes as $o){
                    $sheet->row($i, array(
                        (int)date("Ymd", strtotime($o->fecha_emision)),
                        (int)date("His", strtotime($o->fecha_emision)),
                        (int)$o->numero_orden,
                        (int)$o->tipo_tarjeta,
                        (float)number_format(($o->subtotal_12+$o->subtotal_0), 2),
                        (float)number_format($o->iva, 2),
                        (float)'0.00',
                        (float)number_format($o->intereses/100, 2),
                        (float)number_format($o->total_intereses/100, 2),
                        (int)$o->numero_autorizacion,
                        (int)$empresa->ruc,
                        (int)$o->tipo_credito,
                        (int)$o->meses_credito,
                        'P',
                        '',
                        (int)$o->numero_orden,
                    ));
                    $i++;
                }
            });
        })->export('csv');
@patrickbrouwers
Copy link
Member

You'll have to change the enclosure setting the in the config: https://github.com/Maatwebsite/Laravel-Excel/blob/master/src/config/excel.php#L129

@contifico
Copy link
Author

Excellent, In Laravel, the config file is: ../vendor/maatwebsite/excel/src/config/csv.php thank you..
It'll require more documentation about configurations. anyway thank you again.

@patrickbrouwers
Copy link
Member

If its Laravel 4 it is. The example I gave was for Laravel 5, which has a different way of dealing with config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants