Skip to main content
Announcements
A fresh, new look for the Data Integration & Quality forums and navigation! Read more about what's changed.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Column names with spaces

I need to create an excel output file that uses column headers with spaces, it doesnt look like this is possible is there any work around? I need to you spaces I cannot use _
thanks
Labels (2)
10 Replies
Anonymous
Not applicable
Author

Hello
Column name can't contain spaces. You can use underline '_'.
Best regards

shong
Anonymous
Not applicable
Author

A little more information, I
Alessandro_Lachina
Contributor

why? Excel give the possibility to use space in column name
Anonymous
Not applicable
Author

why? Excel give the possibility to use space in column name

Talend Studio is a Java code generator, a Talend job will be translated to a Java Class, a column on the schema will be a variable in the class, a variable with space or special character is not allowed in Java.
Shong
Alessandro_Lachina
Contributor

any workaround??
Anonymous
Not applicable
Author

any workaround??

Column name can't contain spaces. You can use underline '_' or Talend will replace automatically space with "_" when retrieve schema.
Shong
Anonymous
Not applicable
Author

You cannot specify column names in Excel. You can write anything you want in the first line and decide to call it header line. That's why it looks like Excel allow spaces in column names but actually there are no column names other than the build in name like "A" or "AB"
_AnonymousUser
Specialist III

hi,
you can generate the 1st line with a tFixedFlowInput and complete your excel file without column titles.
Anonymous
Not applicable
Author

We have a hard requirement to create output columns with spaces. I wrote this to a co-worker - any better alternatives? We try to stay Talend only, no external utilities like sed.
It will be ugly: You'll have to do 3 things:
1) write out the header to a temp file with tokens like +++SPACE+++ where there should be spaces (make the column name First+SPACE+Name).
2) rewrite the header out to the real output location, using java, String.replace " " for the token - you can write it out as a one column schema and tFileOutputDelimited for example, using some delimeter that will never come up
3) append to the header file with the real data
So that is a terrible solution but I think what we'll end up with.