我想使用Talend创建一个将多个xls文件导入到MySQL数据库的作业。我不知道这些文件的模式(列数和名称),但我可以假设标题行对应于列名。我的想法是为每个包含xls文件和配置文件的xls模式创建一个文件夹(描述模式和到mySQL表的映射)。所有xls文件必须映射到已存在的单个表。我想知道这在Talend open Studio中是否可行?任何其他解决方案都非常受欢迎。
发布于 2016-04-27 17:08:31
Talend Exchange上有一个组件,您可以利用它来实现这一点。该组件是特定于Excel的,因为它不是基于固定的模式(就像Talend用于的那样),它的工作方式是逐行读取,但它是基于cell的,并逐个读取单元格。
我要做的是让一个任务识别模式,并根据它生成不同的insert查询。我不会对每个模式都有一个工作,但对所有模式都有相同的工作。
1. First job would go cell by cell through the first row (containing the header names) and populate them into a flow. (Row:1, Column:B, Value: "FullName")
2. second part of the job would be to go through cell by cell for the values and get them in a Key-Value way (Row:3, Column:B, Value: "Peter Jackson") into another flow
3. Denormalising the second flow could give you all of the values int the same Excel row.
4. A tMap woud give you the possibility to exchange the Column B with the Fullname attribute and have a concatenation going on that would give you the insert statement.这就是我处理它的方式。做这件事大概需要一两个小时,但应该是可行的。
https://stackoverflow.com/questions/36859873
复制相似问题