talend

Getting File Name and Column names from JSON or CSV Files in Talend Tool


I have CSV and JSON files in folder location. I would like to get the File names and Column names in each files using Talend Tool and load them to a temporary table. Is there any way to do that?

I haven't found much from the Internet.


Solution

  • You could get the filenames from every file in your folder easily with a tFileList followed by a tIterateToFlow. In tIterateToFlow, create a field named "fileName", and check the global variables from tFileList : there are multiple variables, one being the name of the file in the current iteration.

    To get column names on a csv file could be doable if you have them as the first line of your data. Try component like tFileInputRaw maybe.