Kettle provides the Excel input step, in order to read data from Excel files. In this recipe, you will use this step to read an Excel file regarding museums in Italy. The file has a sheet with one column for the name of the museum and other for the city where it is located. The data starts in the C3 cell (as shown in the screenshot in the next section).
For this example, you need an Excel file named museumsItaly.xls
with a museums
sheet, as shown in the following screenshot:
You can download a sample file from the book's site.
Carry out the following steps:
museumsItaly.xls
file and click on the Add button. This will cause the name of the file to be moved to the grid below. museums
in the Sheet name column, 2
in the Start row, and 2
in the Start column. name
and city
fields.The Excel input step allows you to read Excel files. Starting with Kettle 4.1.0, you can also use this step to read OpenOffice calc files.
This recipe showed you the way to read a simple Excel file, with a single sheet. However, the Excel input step allows you to read several Excel files at the same time. You do it just by adding more filename specifications to the grid located under the File tab. The step also allows you to read multiple sheets. You can click on the Get Sheetname(s) button to select from the list of sheets to read. If you don't specify any sheet in the grid, the step will read all of them.
Take care when you leave the sheet name blank or when you select more than one sheet because if the sheets have different structures, you will get an error.
Except for the sheet information, configuring an Excel input step for reading an Excel file is quite the same as configuring a Text file input step. You should not have any troubles making it work.