Hide column label while exporting report

The snapshot of the screen from where we need to export the report is as follows,
following which is the report generated


The expected format of the report is as follows:

Is anyone having any solution for this?

I am also having the same requirement. I have created a script report and when I export the report in an excel sheet I don’t want headers in the excel sheet just want data.

Also, I have tried making column names empty in the report but in this case, when I export an empty row comes up in the excel sheet at the top which is not my requirement. The first row must be data from the report.

Thanks.

Hi,

For hiding the column label, this solution might work for you. with_header need to be set as false to make the column label hide, the method that can be approached here is frappe.utils.xlsxutils.make_xlsx

Example Code:

frappe.ui.form.on('Report', {
    refresh: function(frm) {
        frm.page.add_menu_item(__('hide column'), function() {
            frappe.call({
                method: 'frappe.utils.xlsxutils.make_xlsx',
                args: {
                    data: frm.report_data,
                    sheet_name: frm.name,
                    with_header: false // Set with_header parameter to False to hide column labels
                },
                callback: function(r) {
                    var data = window.open(
                        'data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,' +
                        r.message,
                        '_blank'
                    );
                    data.document.close();
                    data.document.title = `${frm.name}.xlsx`;
                }
            });
        });
    }
});

Thank you.

@VINOTH Thanks for the reply. But, where can I put this JS code.

Yes, you need to apply this in the .js file.

@VINOTH
.js file of my script report?

The doctype where you need this change to be done, on that js you need to apply this code and need to replace the Report to your doctype name.

Thank you.