# Create CSV from (Lens) Table via API / URL

**URL:** <https://discuss.elastic.co/t/create-csv-from-lens-table-via-api-url/368754>\
**Category:** Kibana\
**Tags:** elastic-stack-reporting, visualisation\
**Created:** [October 14, 2024, 7:44am UTC](https://discuss.elastic.co/t/create-csv-from-lens-table-via-api-url/368754 "2024-10-14T07:44:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bianca\_s](https://avatars.discourse-cdn.com/v4/letter/b/ba9def/32.png) [@bianca\_s](https://discuss.elastic.co/u/bianca_s)\
**Post date:** [October 14, 2024, 7:44am UTC](https://discuss.elastic.co/t/create-csv-from-lens-table-via-api-url/368754/1 "2024-10-14T07:44:08Z")

</div>

Hi all,

I wonder if it is possible to create CSV reports from (Lens) tables via an API / URL? I couldn't find anything on that in the documentation.

**Some background on our use case:**  
We would like to automatically send out the contents of a Kibana table via a watcher. The table is a Lens table, but we could recreate it with a different editor if that would offer more possibilities regarding automatic CSV export.

The table is quite big, hence a pdf export didn't work very well for us.

**Version:**  
We're using 7.16, but will migrate to 8.x soon.

Thank you and best regards  
Bianca

---

<div class="post-metadata">

**Author:** ![Marco\_Liberati](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marco_liberati/32/82953_2.png) [@Marco\_Liberati](https://discuss.elastic.co/u/Marco_Liberati)\
**Post date:** [October 14, 2024, 9:14am UTC](https://discuss.elastic.co/t/create-csv-from-lens-table-via-api-url/368754/2 "2024-10-14T09:14:08Z")

</div>

Hi @bianca_s

since 8.14 ES|QL reached the GA status, and that would help to produce programmatically CSV with aggregations with a REST API: [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/esql-rest.html) more details about the new query language and available outputs

---

<div class="post-metadata">

**Author:** ![bianca\_s](https://avatars.discourse-cdn.com/v4/letter/b/ba9def/32.png) [@bianca\_s](https://discuss.elastic.co/u/bianca_s)\
**Post date:** [October 14, 2024, 11:22am UTC](https://discuss.elastic.co/t/create-csv-from-lens-table-via-api-url/368754/3 "2024-10-14T11:22:14Z")

</div>

Hi Marco, thank you for your response, I will look into this. I am not sure though if this will be the right approach for us. Is it correct that ESQL cannot be integrated into watchers? I think search inputs can only handle the Query DSL.

---

<div class="post-metadata">

**Author:** ![Marco\_Liberati](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marco_liberati/32/82953_2.png) [@Marco\_Liberati](https://discuss.elastic.co/u/Marco_Liberati)\
**Post date:** [October 14, 2024, 1:16pm UTC](https://discuss.elastic.co/t/create-csv-from-lens-table-via-api-url/368754/4 "2024-10-14T13:16:45Z")

</div>

You could use Kibana Alerts for that kind of use case rather than Watchers.

---

<div class="post-metadata">

**Author:** ![bianca\_s](https://avatars.discourse-cdn.com/v4/letter/b/ba9def/32.png) [@bianca\_s](https://discuss.elastic.co/u/bianca_s)\
**Post date:** [October 15, 2024, 12:38pm UTC](https://discuss.elastic.co/t/create-csv-from-lens-table-via-api-url/368754/5 "2024-10-15T12:38:48Z")

</div>

Thank you, I will look into this!
