Load xlsx in a folder to RDBMS table with Talend

   

Step 1 . Use tFileList component to get the file list. And set proper property.

Step 2. Use tFileInputExcel to Read Xlsx File. For this, I build a Excel in metadata,

This can help us build the schema for Excel.

Set the excel file property : ((String)globalMap.get("tFileList_1_CURRENT_FILEPATH"))

Step 3. I need add one additional field in the table. This field's value from the file path.

So I add one tMap component,

Use one expression to get the value.

   

Step 4.add one tOracleOutput compoment,

   

You can specify a tableName, and specify the Action on Table, help you create the table.

Now this place , you should take care of one thing, the schema get from upstream,

So you maybe need change the column size for the database table.

   

If we want to use parameter to replace the fixed value for the excel folder, what we should do ?
first , we should build a context in contexts.

Add one variable and set the default value .

Then in the job we create, in the context view, choose that context and variable.

   

Then choose the component tfilelist1 and change the property Directory:context.ExcelFolder(your variable name).

   

When you build the talend to jar, the main entry is the current active job. Pay attention to this.

And it will generate the shell file, context will converted to property file.

   

In the left panel, in Job Designs, right click, choose build job.

Looking for a job working at Home about MSBI
原文地址:https://www.cnblogs.com/huaxiaoyao/p/4158160.html