# How To Create Excel Reports

**URL:** https://discuss.tryton.org/t/how-to-create-excel-reports/1742
**Category:** Developer
**Created:** [September 16, 2019, 9:06am UTC](https://discuss.tryton.org/t/how-to-create-excel-reports/1742 "2019-09-16T09:06:48Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![prashasti.sharma](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/p/58f4c7/32.png) [@prashasti.sharma](https://discuss.tryton.org/u/prashasti.sharma)
#### Post date: [September 16, 2019, 9:06am UTC](https://discuss.tryton.org/t/how-to-create-excel-reports/1742/1 "2019-09-16T09:06:48Z")

</div>

How to create Excel Reports, for many2one fields in different models of the same module??

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [September 16, 2019, 10:26am UTC](https://discuss.tryton.org/t/how-to-create-excel-reports/1742/2 "2019-09-16T10:26:30Z")

</div>

There is no tool by default in Tryton to create Excel files but they are Python library that can be used for that [openpyxl](https://pypi.org/project/openpyxl/) or [XlsxWriter](https://pypi.org/project/XlsxWriter/).  
You can create a `Report` and override the `execute` method to return any binary content generated. You can find an example in [`ModelWorkflowGraph`](http://hg.tryton.org/trytond/file/ea13ee4088c1/trytond/ir/model.py#l1428) report.

Now, instead of using Excel format, you can use the generic CSV exporter of the client. It can define format that uses related values (like `Many2One`) up to any depths. An export format can be saved to be reused later.

---

<div class="post-metadata">

### Author: ![prashasti.sharma](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/p/58f4c7/32.png) [@prashasti.sharma](https://discuss.tryton.org/u/prashasti.sharma)
#### Post date: [September 16, 2019, 11:42am UTC](https://discuss.tryton.org/t/how-to-create-excel-reports/1742/3 "2019-09-16T11:42:06Z")

</div>

I want to export report from excel file sir. How it can be done.

---

<div class="post-metadata">

### Author: ![dave](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/d/ee7513/32.png) [@dave](https://discuss.tryton.org/u/dave)
#### Post date: [September 16, 2019, 12:20pm UTC](https://discuss.tryton.org/t/how-to-create-excel-reports/1742/4 "2019-09-16T12:20:24Z")

</div>

So, you want to import data from an Excel spreadsheet into Tryton?

For simple data, you can save the spreadsheet as a CSV file and use the generic import functionality in the client.

If you are trying to import more complex information then you might want to look at creating a python script using [proteus](http://docs.tryton.org/projects/client-library/en/latest/) and the Python library metioned above:

> [@ced](#):
>
> Python library that can be used for that [openpyxl](https://pypi.org/project/openpyxl/)

---

<div class="post-metadata">

### Author: ![prashasti.sharma](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/p/58f4c7/32.png) [@prashasti.sharma](https://discuss.tryton.org/u/prashasti.sharma)
#### Post date: [September 17, 2019, 9:15am UTC](https://discuss.tryton.org/t/how-to-create-excel-reports/1742/5 "2019-09-17T09:15:12Z")

</div>

Thank You Sir,  
But I am not looking for importing of data from CSV to tryton  
My query is how can I create a report in .csv format.  
I have created reports in .PDF format earlier, looking to make similar reports in the .CSV format, too.

---

<div class="post-metadata">

### Author: ![dave](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/d/ee7513/32.png) [@dave](https://discuss.tryton.org/u/dave)
#### Post date: [September 17, 2019, 10:00am UTC](https://discuss.tryton.org/t/how-to-create-excel-reports/1742/6 "2019-09-17T10:00:20Z")

</div>

Sorry, I misunderstood you when you said

> [@prashasti.sharma](#):
>
> I want to export report from excel file

The original reply is what you are looking for then:

> [@ced](#):
>
> You can create a `Report` and override the `execute` method…
> 
> … you can use the generic CSV exporter of the client.

---

<div class="post-metadata">

### Author: ![mono](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/mono/32/289_2.png) [@mono](https://discuss.tryton.org/u/mono)
#### Post date: [September 17, 2019, 4:23pm UTC](https://discuss.tryton.org/t/how-to-create-excel-reports/1742/7 "2019-09-17T16:23:03Z")

</div>

> [@prashasti.sharma](#):
>
> I have created reports in .PDF format earlier, looking to make similar reports in the .CSV format, too.

If you already has created report to create csv report is very easy: the csv file is a plain file.

- You can create a txt report([http://hg.tryton.org/relatorio/file/tip/examples/basic.tex](http://hg.tryton.org/relatorio/file/tip/examples/basic.tex)) with the csv structure.
- In the definition of report you has to add:

> ```
> <field name="template_extension">txt</field>
> <field name="extension">csv</field>
> 
> ```

But I thik taht the best option is ods format. 🙂

---

<div class="post-metadata">

### Author: ![prashasti.sharma](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/p/58f4c7/32.png) [@prashasti.sharma](https://discuss.tryton.org/u/prashasti.sharma)
#### Post date: [September 24, 2019, 6:56am UTC](https://discuss.tryton.org/t/how-to-create-excel-reports/1742/8 "2019-09-24T06:56:36Z")

</div>

Sir, using openxlsx csv file is generated but how to create it as pdf file and can be printed as an pdf file.

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [September 24, 2019, 7:28am UTC](https://discuss.tryton.org/t/how-to-create-excel-reports/1742/9 "2019-09-24T07:28:44Z")

</div>

Make an ODS template using relatorio and configure the report to render as PDF.

---

<div class="post-metadata">

### Author: ![prashasti.sharma](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/p/58f4c7/32.png) [@prashasti.sharma](https://discuss.tryton.org/u/prashasti.sharma)
#### Post date: [September 24, 2019, 9:15am UTC](https://discuss.tryton.org/t/how-to-create-excel-reports/1742/10 "2019-09-24T09:15:39Z")

</div>

Sir, are there any examples of ODS templates you can provide or are given in relatorio docs and source code?

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [September 24, 2019, 9:59am UTC](https://discuss.tryton.org/t/how-to-create-excel-reports/1742/11 "2019-09-24T09:59:34Z")

</div>

There is an [ODS example](https://relatorio.readthedocs.io/en/latest/indepthexample.html#one-step-further-openoffice-calc-and-openoffice-impress-templates) in the documentation.

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [November 12, 2019, 9:38am UTC](https://discuss.tryton.org/t/how-to-create-excel-reports/1742/13 "2019-11-12T09:38:20Z")

</div>

A post was split to a new topic: [How to put text and value in relatorio ODS](https://discuss.tryton.org/t/how-to-put-text-and-value-in-relatorio-ods/1936)
