Problem with Excel Export - returned empty file

Hi All,

I’m trying to export to excel by using Dhtmlx gantt.exportToexcel method and it returned empty file.
var json = gantt.serialize();
Can you please help me to find out the root cause of this issue.

Anuj kumar dixit

Hello Anuj,
gantt.exportToExcel() function has the data parameter, although it is not documented. And it doesn’t work as expected. The columns with the templates will be empty when you export them. It will be fixed in the future.
Now, you can specify the data by using this command:

var json = gantt.serialize().data;

thanks for reply. I have used same method as well but tasks indented is not clear Parent/Child relationship in excel. As it is mentioned in the below example.

If you check this example by clicking on export to excel button. it will give you the right excel sheet with Parent/Child relationship in excel. When i’m trying with below method. Tasks indented is not clear Parent/Child relationship in excel.

let config = { open_tree_initially: true };
config = this.defaults(config, {
name: “gantt.xlsx”,
data: this.gantt._serialize_table(config).data,
columns: this.gantt._serialize_columns({ rawDates: true }),
version: this.gantt.version,
server: “http://localhost:8199
this.gantt._send_to_export(config, “excel”);

I don’t know what configuration. i have missed.

Hello Anuj,
Please, do not create duplication questions in different places.
Let’s continue our discussion here: