Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

293
Vistas
How to format cells in excelsheet for export to excel in ReactJs

I am new at this, tried to find ways to do it,but was not able to.

I am performing export to excel on a click of Export button and data to be saved in .csv file or .xlsx file format.

I want the data to be saved in below way:

enter image description here

But somehow I dont know how to do it in ReactJs.

I have tried something like this :

this.state = {
            headers: [
                { key: 'srNo', label: 'srNo' },
                { key: 'student', label: 'student'}, 
                { key: 'student.firstname', label: 'firstname'},
                { key: 'student.lastname', label: 'lastname'},
                { key: 'student.age', label: 'age'},
            ]
        };

<Button>

                                <Button 
                                    style={{ float: "right", margin: "5px" }}
                                    variant="contained"
                                    color="primary"
                                    onClick={this.ExportToExcel}
                                    data={this.props.student.records}
                                    headers={this.state.headers}
                                    filename={"test.csv"}
                                    // filename={"menu.csv"}
                                    className="btn btn"
                                    target="_blank"
                                    >
                                        Export
                                    </Button>

I get all the proper data from the database. I just want it to get exported in a particular way in excel file as shown in the image above. Also see how the rows and columns are merged with center as formatting and the font being bold. I want my data to get export in the exact same way as in the image above.

I need to do proper formatting of the excel file in headers or so.

I don't know how to go about it. Need help.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda