# Exportation des données au format CSV

**URL:** <https://community.gladysassistant.com/t/exportation-des-donnees-au-format-csv/8750>\
**Category:** Demandes livrées\
**Tags:** feature-core, in-progress\
**Created:** [Mars 2, 2024, 12:38 UTC](https://community.gladysassistant.com/t/exportation-des-donnees-au-format-csv/8750 "2024-03-02T12:38:30Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ric](https://gladys-assistant-community.b-cdn.net/letter_avatar_proxy/v4/letter/r/c77e96/32.png) [@Ric](https://community.gladysassistant.com/u/Ric)\
**Post date:** [Mars 2, 2024, 12:38 UTC](https://community.gladysassistant.com/t/exportation-des-donnees-au-format-csv/8750/1 "2024-03-02T12:38:30Z")

</div>

Bonjours la communauté, 🖖

Pour reprendre l’idée de @Prof_Techno, serait il possible de créer une fonctionnalité permettant d’exporter les données au format CVS afin de les croiser avec d’autres données externes?

Merci beaucoup. 🙂

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [Mars 4, 2024, 8:19 UTC](https://community.gladysassistant.com/t/exportation-des-donnees-au-format-csv/8750/2 "2024-03-04T08:19:26Z")

</div>

Salut @Ric 🙂 Bonne idée, pense à voter pour la fonctionnalité, on verra si il y a de la demande !

---

<div class="post-metadata">

**Author:** ![Jluc](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/jluc/32/12397_2.png) [@Jluc](https://community.gladysassistant.com/u/Jluc)\
**Post date:** [Novembre 4, 2025, 10:03 UTC](https://community.gladysassistant.com/t/exportation-des-donnees-au-format-csv/8750/3 "2025-11-04T10:03:26Z")

</div>

Bonjour,

Avant j’enregistrais mes consommations (eau, électricité) sur excel. Depuis que j’utilise Gladys je dispose de beaucoup plus de données mais elle ne s’affichent que pendant un an. Dans la configuration le choix illimité est disponible mais au final, pas les données.

L’historique sur un an est intéressant à comparer à d’autres années alors si ce n’est pas possible sur Gladys, est-ce possible d’enregistrer les données pour les exporter ?

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [Novembre 4, 2025, 6:28 UTC](https://community.gladysassistant.com/t/exportation-des-donnees-au-format-csv/8750/4 "2025-11-04T18:28:26Z")

</div>

C’est vrai que ce serait chouette de pouvoir analyser ses données sur des plus longues durées. @Terdious avait travaillé sur ce sujet à un moment mais ça n’a pas abouti, je ne sais pas si il y a une demande de fonctionnalité pour ça, ça serait chouette !

> [@Jluc](#):
>
> est-ce possible d’enregistrer les données pour les exporter ?

Actuellement tu peux faire des exports via l’API, ça se fait assez facilement ! C’est sûr, c’est plus compliqué qu’un clic, mais c’est pas non plus hyper compliqué. Si ça t’intéresse, je peux te faire un tutoriel 🙂

---

<div class="post-metadata">

**Author:** ![Jluc](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/jluc/32/12397_2.png) [@Jluc](https://community.gladysassistant.com/u/Jluc)\
**Post date:** [Novembre 5, 2025, 10:33 UTC](https://community.gladysassistant.com/t/exportation-des-donnees-au-format-csv/8750/5 "2025-11-05T10:33:58Z")

</div>

Je veux bien un tuto si ce n’est pas risqué de l’appliquer. Merci @pierre-gilles

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [Novembre 6, 2025, 12:59 UTC](https://community.gladysassistant.com/t/exportation-des-donnees-au-format-csv/8750/6 "2025-11-06T12:59:42Z")

</div>

@Jluc Hop je t’ai écris un beau tuto :

> [@Télécharger un CSV des valeurs historiques d'un capteur](https://community.gladysassistant.com/t/telecharger-un-csv-des-valeurs-historiques-dun-capteur/9808):
>
> Salut à tous ! Je vous propose aujourd’hui un petit tutoriel pour télécharger un CSV de toutes les valeurs historiques d’un capteur. Pour cela, nous allons passer par l’API HTTP de Gladys. Étape n°1 : Télécharger un client HTTP Je vous conseille [Yaak](https://yaak.app/). Étape n°2 : Récupérer un token L’API de Gladys étant sécurisée, il va falloir récupérer un token. Créez une nouvelle requête dans Yaak sur l’URL Méthode : POST URL : http://IP\_DE\_VOTRE\_INSTANCE\_GLADYS/api/v1/login Body Type : JSON Body : …

C’est une bonne occasion de tester l’API de Gladys, ça peut servir pour plein de choses 😉

---

<div class="post-metadata">

**Author:** ![Jluc](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/jluc/32/12397_2.png) [@Jluc](https://community.gladysassistant.com/u/Jluc)\
**Post date:** [Novembre 6, 2025, 1:03 UTC](https://community.gladysassistant.com/t/exportation-des-donnees-au-format-csv/8750/7 "2025-11-06T13:03:24Z")

</div>

Super, il va falloir que je me lance 🙂

Merci et si ça sert à de nombreux utilisateurs Gladys, c’est parfait !

---

<div class="post-metadata">

**Author:** ![cursor-bot](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/cursor-bot/32/22252_2.png) [@cursor-bot](https://community.gladysassistant.com/u/cursor-bot)\
**Post date:** [Août 17, 2026, 12:07 UTC](https://community.gladysassistant.com/t/exportation-des-donnees-au-format-csv/8750/8 "2026-08-17T12:07:24Z")

</div>

Salut tout le monde !

Ce sujet est désormais **en cours de développement**.

Une PR a été ouverte pour exporter l’historique d’un élément en CSV depuis le widget graphique :

> <https://github.com/GladysAssistant/Gladys/pull/2909>
>
> Implements feature request: https://community.gladysassistant.com/t/exportation-…des-donnees-au-format-csv/8750
> 
> \### Description
> 
> Users asked on the forum for a way to export their history (device feature values, energy/water consumption in particular) as CSV, so they can cross-analyse it in a spreadsheet with external data and compare one year with another. Until now the only way was to script the REST API by hand.
> 
> This PR adds one complete export path, plugged into the place where users already look at their history: the chart widget.
> 
> \*\*Server\*\*
> 
> \- New \`device.exportStatesToCsv(deviceFeatureSelectors, start, end)\` (\`server/lib/device/device.exportStatesToCsv.js\`). It reuses the existing raw history query (\`getDeviceFeatureStates\`) for each selected feature and merges everything into one date-ordered file with the columns \`date,device,feature,unit,value\` (long format, easy to pivot in a spreadsheet). Values containing a separator, a quote or a line break are properly escaped.
> \- New authenticated route \`GET /api/v1/device\_feature/states\_csv?device\_features=a,b&start=\<ISO\>&end=\<ISO\>\`, answering \`text/csv; charset=utf-8\` with a \`Content-Disposition\` filename. It is usable directly from the API too, which also covers the scripting use case discussed on the forum.
> \- Invalid input is rejected with clear \`BadParameters\` errors (no feature, invalid dates, end before start), and an unknown feature returns a 404.
> \- The file is built in memory, so the export is refused upfront when the period contains more than \`MAX\_STATES\_TO\_EXPORT\_IN\_CSV\` (500 000) states: a very chatty sensor over a year cannot exhaust the memory of a Raspberry Pi. The error message tells the user to export a shorter period.
> 
> \*\*Front\*\*
> 
> \- An "Export as CSV" entry is added at the bottom of the chart widget period menu. It exports exactly the device features and the period currently displayed, so the existing period navigation (previous/next period) lets a user export a past year as well.
> \- The downloaded file starts with a UTF-8 BOM so spreadsheets (Excel in particular) display accented device names correctly.
> \- Errors are displayed in the widget, with the server detail (e.g. "period too large").
> \- New i18n keys \`dashboard.boxes.chart.exportCsv\` and \`dashboard.boxes.chart.exportCsvError\` added to \`en\`, \`fr\` and \`de\`.
> 
> \## Forum
> 
> Forum: https://community.gladysassistant.com/t/exportation-des-donnees-au-format-csv/8750
> 
> \### Checklist
> 
> \- \[x\] Tests pass: \`cd server && npm test\` (full Mocha suite — the only failures are pre-existing environment ones: gateway backup/restore tests needing the \`sqlite3\` CLI, Docker socket and network, identical before and after this change). Coverage checked on the changed files: \`server/lib/device/device.exportStatesToCsv.js\` is at 100% statements/branches/functions/lines, and the new controller lines are covered by \`server/test/controllers/device/device.controller.test.js\`. Cypress was not run (no browser binary in this environment).
> \- \[x\] Linter and prettier pass on both front and server (\`npm run eslint\`, \`npm run prettier\` / \`prettier-check\`), plus \`npm run compare-translations\` and \`npm run build\` on the front.
> \- \[x\] No undocumented breaking change (purely additive: one new route, one new lib function, one new UI entry point).
> 
> \> This pull request was opened by an automated Claude Code run. It needs a human review before merging.
> 
> 
> \---
> \_Generated by \[Claude Code\](https://claude.ai/code/session\_01BRdJPgpjHkz9LKu39n8fm8)\_
> 
> 
> \## Summary by CodeRabbit
> 
> \* \*\*New Features\*\*
> \* Added CSV export for chart data using selected device features and the displayed time period.
> \* Downloads include readable filenames and properly formatted, spreadsheet-safe CSV content.
> \* Added loading indicators, export controls, and clear error messages when exports fail.
> \* Added support for English, German, and French export labels and messages.
> \* \*\*Bug Fixes\*\*
> \* Added validation for missing features, invalid dates, duplicate selections, and oversized export requests.
> \* Improved handling of legacy single-feature charts and empty time periods.

N’hésitez pas à suivre la PR, à tester dès que possible et à faire vos retours ici.

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [Août 21, 2026, 1:40 UTC](https://community.gladysassistant.com/t/exportation-des-donnees-au-format-csv/8750/9 "2026-08-21T13:40:12Z")

</div>

En vue desktop :

 ![finaldesktop](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/0/3/033aecd8693781f45829d9d5ebd6d98ee41bda22.jpeg)

En vue mobile :

 ![mobile](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/5/3/53211ebd6fb62c1eade8f15f7951c82032f4b250.png)

Bien-sûr, avec le nouveau thème 😉

---

<div class="post-metadata">

**Author:** ![cursor-bot](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/cursor-bot/32/22252_2.png) [@cursor-bot](https://community.gladysassistant.com/u/cursor-bot)\
**Post date:** [Août 28, 2026, 12:29 UTC](https://community.gladysassistant.com/t/exportation-des-donnees-au-format-csv/8750/10 "2026-08-28T12:29:31Z")

</div>


