dosubot[bot] commented on issue #30204:
URL: https://github.com/apache/superset/issues/30204#issuecomment-2339467800

   <!-- Answer -->
   I found a similar issue that might be relevant to your problem: [Excel 
export option missing in sql 
lab](https://github.com/apache/superset/issues/25863). This issue is closed and 
was last updated on June 28, 2024. It was referenced by a pull request that 
added the Excel export feature 
<sup>[[1]](https://github.com/apache/superset/issues/25863)</sup>.
   
   Regarding the "Download to CSV" option in Superset 4.1.0rc2, there have been 
changes in the UI. The "Download to CSV" functionality has been moved to a 
submenu under "Download" in the newer version. Here is the relevant code 
snippet:
   
   ```tsx
   {props.supersetCanCSV && (
     <Menu.SubMenu
       title={t('Download')}
       key={MenuKeys.Download}
       onTitleMouseEnter={() => setOpenKeys(undefined)}
     >
       <Menu.Item
         key={MenuKeys.ExportCsv}
         icon={<Icons.FileOutlined css={dropdownIconsStyles} />}
       >
         {t('Export to .CSV')}
       </Menu.Item>
       {isPivotTable && (
         <Menu.Item
           key={MenuKeys.ExportPivotCsv}
           icon={<Icons.FileOutlined css={dropdownIconsStyles} />}
         >
           {t('Export to Pivoted .CSV')}
         </Menu.Item>
       )}
       <Menu.Item
         key={MenuKeys.ExportXlsx}
         icon={<Icons.FileOutlined css={dropdownIconsStyles} />}
       >
         {t('Export to Excel')}
       </Menu.Item>
     </Menu.SubMenu>
   )}
   ```
   
   Additionally, ensure that the `csv` property is set to `true`, the user has 
the `can_export_csv` permission, and the `ALLOW_FULL_CSV_EXPORT` feature flag 
is appropriately configured. The relevant configuration settings are:
   
   ```tsx
   export interface ResultSetProps {
     ...
     csv?: boolean;
     ...
   }
   
   const ResultSet = ({
     ...
     csv = true,
     ...
   }: ResultSetProps) => {
     ...
     const canExportData = findPermission(
       'can_export_csv',
       'SQLLab',
       user?.roles,
     );
   
     const renderControls = () => {
       if (search || visualize || csv) {
         ...
         return (
           <ResultSetControls>
             ...
             <ResultSetButtons>
               ...
               {csv && canExportData && (
                 <Button
                   buttonSize="small"
                   href={getExportCsvUrl(query.id)}
                   data-test="export-csv-button"
                   onClick={() => logAction(LOG_ACTIONS_SQLLAB_DOWNLOAD_CSV, 
{})}
                 >
                   <i className="fa fa-file-text-o" /> {t('Download to CSV')}
                 </Button>
               )}
               ...
             </ResultSetButtons>
             ...
           </ResultSetControls>
         );
       }
       return <div />;
     };
     ...
   };
   ```
   
   In the configuration file `superset/config.py`, the feature flag 
`ALLOW_FULL_CSV_EXPORT` can be set to control whether users are allowed to 
export full CSVs of table visualizations:
   
   ```py
   DEFAULT_FEATURE_FLAGS: dict[str, bool] = {
       ...
       "ALLOW_FULL_CSV_EXPORT": False,
       ...
   }
   ```
   
   Make sure these settings are correctly configured to enable the "Download to 
CSV" option 
<sup>[[2]](https://github.com/apache/superset/blob/master/superset-frontend/src/SqlLab/components/ResultSet/index.tsx)</sup><sup>[[3]](https://github.com/apache/superset/blob/master/superset/config.py)</sup><sup>[[4]](https://github.com/apache/superset/blob/master/superset-frontend/src/dashboard/components/SliceHeaderControls/index.tsx)</sup>.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   


-- 
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