# Columns exported from Tabular CSV are reshuffled

**URL:** <https://discuss.elastic.co/t/columns-exported-from-tabular-csv-are-reshuffled/340921>\
**Category:** Kibana\
**Tags:** elastic-stack-reporting, lens\
**Created:** [August 16, 2023, 12:59pm UTC](https://discuss.elastic.co/t/columns-exported-from-tabular-csv-are-reshuffled/340921 "2023-08-16T12:59:07Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arshukla](https://avatars.discourse-cdn.com/v4/letter/a/c68b51/32.png) [@Arshukla](https://discuss.elastic.co/u/Arshukla)\
**Post date:** [August 16, 2023, 12:59pm UTC](https://discuss.elastic.co/t/columns-exported-from-tabular-csv-are-reshuffled/340921/1 "2023-08-16T12:59:08Z")

</div>

Hello Team,

Columns are getting reshuflled when exported to CSV format

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/0/e/0ed6d82211fa92a6c95fd77d337d447bf6d6c555.png)  
When exported in CSV, columns are getting shifted  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/8/c/8cb028d48a52a30bc2eb1f36da7c332e7cef79a4.png)

Please can you help me for how to resolve this one

---

<div class="post-metadata">

**Author:** ![Arshukla](https://avatars.discourse-cdn.com/v4/letter/a/c68b51/32.png) [@Arshukla](https://discuss.elastic.co/u/Arshukla)\
**Post date:** [August 21, 2023, 4:28am UTC](https://discuss.elastic.co/t/columns-exported-from-tabular-csv-are-reshuffled/340921/2 "2023-08-21T04:28:10Z")

</div>

Hello Team,  
Please help me for the above query... Need your support for same

---

<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:** [August 21, 2023, 1:36pm UTC](https://discuss.elastic.co/t/columns-exported-from-tabular-csv-are-reshuffled/340921/3 "2023-08-21T13:36:24Z")

</div>

Hi @Arshukla

what version of the stack are you using? Is this limited only to saved searches or also aggregation-based tables (i.e. TSVB/Lens/Agg-based editor)?

---

<div class="post-metadata">

**Author:** ![Arshukla](https://avatars.discourse-cdn.com/v4/letter/a/c68b51/32.png) [@Arshukla](https://discuss.elastic.co/u/Arshukla)\
**Post date:** [August 21, 2023, 1:43pm UTC](https://discuss.elastic.co/t/columns-exported-from-tabular-csv-are-reshuffled/340921/4 "2023-08-21T13:43:52Z")

</div>

Hello Marco,  
I am using Kibana version of 8.6.1 and this issue is being faced on Lens.

---

<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:** [August 21, 2023, 1:51pm UTC](https://discuss.elastic.co/t/columns-exported-from-tabular-csv-are-reshuffled/340921/5 "2023-08-21T13:51:06Z")

</div>

Are you defining any column via the `Split metrics by` group?

 ![Screenshot 2023-08-21 at 15.50.49](https://us1.discourse-cdn.com/elastic/original/3X/3/9/39e3738939f9350e346966d3b7b51afd35a55b16.png)

---

<div class="post-metadata">

**Author:** ![Arshukla](https://avatars.discourse-cdn.com/v4/letter/a/c68b51/32.png) [@Arshukla](https://discuss.elastic.co/u/Arshukla)\
**Post date:** [August 22, 2023, 4:50am UTC](https://discuss.elastic.co/t/columns-exported-from-tabular-csv-are-reshuffled/340921/6 "2023-08-22T04:50:55Z")

</div>

NO Marco. I have defined all columns either in Rows and Metrics

---

<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:** [August 22, 2023, 10:24am UTC](https://discuss.elastic.co/t/columns-exported-from-tabular-csv-are-reshuffled/340921/7 "2023-08-22T10:24:58Z")

</div>

I've managed to reproduce the problem and logged an enhancement request here: [[Lens] CSV export does not respect columns order from table · Issue #164413 · elastic/kibana · GitHub](https://github.com/elastic/kibana/issues/164413)

---

<div class="post-metadata">

**Author:** ![Arshukla](https://avatars.discourse-cdn.com/v4/letter/a/c68b51/32.png) [@Arshukla](https://discuss.elastic.co/u/Arshukla)\
**Post date:** [August 22, 2023, 11:57am UTC](https://discuss.elastic.co/t/columns-exported-from-tabular-csv-are-reshuffled/340921/8 "2023-08-22T11:57:24Z")

</div>

So, the solution will be available in next version of Kibana ?

---

<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:** [August 22, 2023, 1:16pm UTC](https://discuss.elastic.co/t/columns-exported-from-tabular-csv-are-reshuffled/340921/9 "2023-08-22T13:16:07Z")

</div>

We cannot guarantee a specific release date for the issue. But you can track it on github to know when it would be addressed.

---

<div class="post-metadata">

**Author:** ![Arshukla](https://avatars.discourse-cdn.com/v4/letter/a/c68b51/32.png) [@Arshukla](https://discuss.elastic.co/u/Arshukla)\
**Post date:** [August 24, 2023, 6:53am UTC](https://discuss.elastic.co/t/columns-exported-from-tabular-csv-are-reshuffled/340921/10 "2023-08-24T06:53:12Z")

</div>

Hello @Marco_Liberati,  
This situation is typically unexpected, as the data should ideally be downloaded in the same order as the variables are arranged in the table. It appears that this isn't an improvement in functionality but rather a bug, as the variable order is becoming altered.

---

<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:** [August 24, 2023, 7:05am UTC](https://discuss.elastic.co/t/columns-exported-from-tabular-csv-are-reshuffled/340921/11 "2023-08-24T07:05:37Z")

</div>

In a CSV the order of the column should not matter as long as the header is exported as well.  
I see how keeping the order of the columns is nicer rather than re-shuffle them, but that's not strictly required, hence the "enhancement" tag.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 21, 2023, 7:05am UTC](https://discuss.elastic.co/t/columns-exported-from-tabular-csv-are-reshuffled/340921/12 "2023-09-21T07:05:38Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
