Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I'm reading data from two excel files by using a loop. One Excel has 72 fields and other excel has 76 fields .
Problem:
1. case of column names is inconsistent so while concatenating data from each file it creating multiple columns.
Ex: Country(from first xls) , counTry(from second xls) is bought into 2 different columns instead of one due to case inconsistent in xls files.
1. Can we convert all the fields from both tables to Upper case irrespective of the data and
2. Join them into a single table.
could you please help me with the syntax?
Attached Excel files for your reference.
You can try something like this.
Uppercase:
Load null() as null
AutoGenerate 0;
for each vFile in filelist('*.xlsx')
Table:
LOAD *
FROM $(vFile)
(ooxml, embedded labels, table is Sheet1);
Let sLoad = '';
for i = 1 to NoOfFields('Table')
let sField = FieldName(i,'Table');
if sLoad <> '' then
let sLoad = sLoad & ',';
end if
let sLoad = sLoad & '[' & sField & '] AS [' & upper(sField) & ']';
next
drop table Table;
Concatenate(Uppercase)
Load $(sLoad)
FROM $(vFile)
(ooxml, embedded labels, table is Sheet1);
next
drop field null;