Exporting results of a Mysql query to excel ?

Exporting results of a Mysql query to excel ?

Asked on January 8, 2019 in Excel.
Add Comment


  • 3 Answer(s)

    The best solution is here :

        The usual way to accomplish this is to convey to CSV and then load the CSV into Excel.
    To do this by along with the INTO OUTFILE clause on your SELECT statement, by using any MySQL command line tool.

    SELECT ... FROM ... WHERE ...
    INTO OUTFILE 'file.csv'
    FIELDS TERMINATED BY ','
    

    click here to more information.

    By using the –tab option, can apply mysqldump to store dump into a divided value format. Try this link.

    mysqldump -u<user> -p<password> -h<host> --where=jtaskResult=2429 --tab=<file.csv> <database> TaskResult
    
    Answered on January 8, 2019.
    Add Comment

    Use this alternative solution :

    select 'idPago','fecha','lead','idAlumno','idTipoPago','idGpo'
    union all
    (select id_control_pagos, fecha, lead, id_alumno, id_concepto_pago, id_Gpo,id_Taller,
    id_docente, Pagoimporte, NoFactura, FacturaImporte, Mensualidad_No, FormaPago,
    Observaciones from control_pagos
    into outfile 'c:\\data.csv'
    FIELDS TERMINATED BY ','
    OPTIONALLY ENCLOSED BY '"'
    LINES TERMINATED BY '\n');
    
    Answered on January 8, 2019.
    Add Comment

    Try this following query for exporting results of a Mysql query to excel :

    SELECT * FROM document INTO OUTFILE 'c:/order-1.csv' FIELDS TERMINATED BY ','
    ENCLOSED BY '"' LINES TERMINATED BY '\n';
    
    Answered on January 8, 2019.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.