One Star

SELECT FEW COLUMNS FROM A CSV OR EXCEL FILE

Hi everybody,
well,I'm a beginner in TOS for data integration and I need to create a job that will take a csv or Excel file as a source of data but will select just somme columns and remove the others.How can I do that.Thank you so much in advance Smiley Happy
11 REPLIES
Seventeen Stars

Re: SELECT FEW COLUMNS FROM A CSV OR EXCEL FILE

You can use the build-in components for csv or excel files and use a tMap to extract the columns you need
tFileInputDelimited --> tMap --> any output component
or you can use components from Talend Exchange:
for CSV: tFileInputTextFlat : this component lets you deside which column you want to read and you can use a header line to get the correct position
for Excel: tFileExcelSheetInput: this component also let you decide which column you need and you have also the possiibility to get the correct column position by a header line (this component needs the component tFileExcelWorkbookOpen)
Moderator

Re: SELECT FEW COLUMNS FROM A CSV OR EXCEL FILE

Hi,
Or tFilterColumns to filter these columns.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Employee

Re: SELECT FEW COLUMNS FROM A CSV OR EXCEL FILE

1 for the tFilterColumns Smiley Happy
When you are using a tFilterColumns, the job design is really clear. All the users will understand this component is for filter the columns. When you are using a tMap, it's not obvious to know what kind of transformation you are doing.
tMap is a very powerfull tool, with a great graphical user interface... and use it for filter the columns is not a bad idea: it's running perfectly!
However the other components can give your job design more understandable.

More information about the tMap on Talend Help Center:tMap
Best Regards,
Olivier
One Star

Re: SELECT FEW COLUMNS FROM A CSV OR EXCEL FILE

Hi everybody again!
Thanks a lot for your help,I have succeded to implement a first easy job Smiley Happy
Now I have another issue,I have to create the same job using two CSV files as a source for data, but those two files complete each others. in the first file we find column A B C for exemple and in the second we have the columns A and B and there is no C but we have some other columns D and E .Now I have to create a csv file that contains the columns A B C D and not E with all the lines that exists in the two files.
Thanks in advance for your help and sorry for bothering you whith my stupid questions Smiley Tongue
Seven Stars

Re: SELECT FEW COLUMNS FROM A CSV OR EXCEL FILE

You need to join the two files in tMap on columns A and B and then output the columns you want.
One Star

Re: SELECT FEW COLUMNS FROM A CSV OR EXCEL FILE

Hi Experts,
well,I'm a beginner in TOS for data integration and I need to create a job that will take a csv or Excel file as a source of data but will select only 20 columns in 230 and the position is also vary for columns. Just like first column is in 9th place and the second column is in 12 th and the third column is in 6th place and so on... How can I do that.Thank you so much in advance.
Moderator

Re: SELECT FEW COLUMNS FROM A CSV OR EXCEL FILE

Hi KingofAngels,

Are you referring to positional file?

Could you please take a look at component TalendHelpCenter:tFileInputPositional which reads a given file row by row and extracts fields based on a pattern.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: SELECT FEW COLUMNS FROM A CSV OR EXCEL FILE

Read all the columns and pass to a tMap for selection.
You can generate the file/excel schema in metadata.
One Star

Re: SELECT FEW COLUMNS FROM A CSV OR EXCEL FILE

Hi everybody,
I'm newbie in TOS and I have to create a job for import many excel sheets in a PostgreSQL table. My problem is that the rows in Excel table can change: from 30 to 70 depends on the sheet. I read alot of post but now I have a great confusion in my head. Maybe I have to use a context but in version 6.0 is different from this tutorial or is there something simpler ?
Moderator

Re: SELECT FEW COLUMNS FROM A CSV OR EXCEL FILE

Hi romidipa,
There is a custom component tFileExcelSheetInput shared by Talend Community user, which can read an excel sheet in a very flexible way.
Could you please check the custom component on Talend Exchange?
https://exchange.talend.com/#marketplaceproductoverview:gallery=marketplace%252F1&pi=marketplace%252...
Here is a kb article about:TalendHelpCenter:Installing a custom component
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: SELECT FEW COLUMNS FROM A CSV OR EXCEL FILE

Thanks a lot Sabrina, i will have a look