In this section, we show how to use tFileOutputExcel to export database tables to Excel in Talend with an example. For this tFileOutputExcel demo, we are using the SQL Database table, and the data inside this table is
Talend Export Database Table to Excel File Example
From the below Talend image, you can see that we established an SQL connection with and selected the Customer table using the DBInput.
Next, drag and drop the tFileOutputExcel output field from the palette. As you can see from the tooltip, the Talend tFileOutputExcel writes the cell row by row in a Microsoft Excel file.
Please connect the DBInput source to tFileOutputExcel. The following screenshot shows the list of available options in the Talend tFileOutputExcel component tab to export the database table to an Excel file.
- Write excel2007 file format (xlsx) – It writes the output in 2007 format.
- Include Header: Do you want to include the header names or not?
- Append existing file: Do you want to append the data to an existing file or not?
- Changing the font style.
- Do you wish to auto-size the columns or a few of them by checking the boxes beside them?
By default, the tFileOutputExcel field selects the default location and out.xls as the file name. Please click on the browse (…) button to select the existing file or create a new Excel file. Here, we are creating the Customers_Excel.xls in the Output files directory.
Next, we selected the Font Courier New from the drop-down list. And Define all columns to auto-size option. You can see all the options that we selected for this example in the below screenshot.
Next, click the Edit Schema button to check the Talend tFileOutputExcel schema.
Let me run the Talend tFileOutputExcel job to see whether we exported the Database Table to an Excel File.
You can see the output file generated by the Talend tFileOutputExcel job.