msyavuz commented on code in PR #38513:
URL: https://github.com/apache/superset/pull/38513#discussion_r2927600853


##########
superset/views/core.py:
##########
@@ -206,6 +210,19 @@ def generate_json(
         payload = viz_obj.get_payload()
         return self.send_data_payload_response(viz_obj, payload)
 
+    @staticmethod
+    def _generate_xlsx(viz_obj: BaseViz) -> FlaskResponse:
+        import pandas as pd
+
+        from superset.utils.excel import df_to_excel
+
+        payload = viz_obj.get_df_payload()
+        df = payload.get("df")
+        if df is None:
+            df = pd.DataFrame()
+        xlsx_data = df_to_excel(df, index=False)
+        return XlsxResponse(xlsx_data, 
headers=generate_download_headers("xlsx"))

Review Comment:
   I think this might be relevant. I can see in 
`superset/common/query_context_processor.py` L:261 we do apply column types



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to