Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Uday
Contributor
Contributor

Have different csv files with column names and positions change

I have multiple csv files with columns Date, column1, column2 in one csv and Date, column 2, column 1, and Time, column 1, column 2.... 

 

I have to check the column names and then remove or add spaces in the column name and if required change the column position.

 

Out of the mentioned scenarios I want the load to be done as "Date/Time, column1/column 1, column2/Column 2

 

Please help me

Labels (3)
2 Replies
chrismarlow
Specialist II
Specialist II

Hi,

You can use AS after your field names to rename, check this for more on the syntax (is about a page down);

https://help.qlik.com/en-US/qlikview/November2018/Subsystems/Client/Content/QV_QlikView/Scripting/Sc...

If your tables have the same field names QlikView should concatenate them, however it can be forced by putting Concatenate(first table name) before the load statement for your subsequent tables, see here for syntax;

https://help.qlik.com/en-US/qlikview/November2018/Subsystems/Client/Content/QV_QlikView/Scripting/Sc...

Cheers,

Chris.

 

 

Vegar
MVP
MVP

If you have a limited fixed amount of csv files and know which ones have which column name combinations then you could use the renaming technique @chrismarlow mentioned.

If you have av various number of files where you do not know the column naming I would recommend using the ALIAS functionality.

CsvData:
LOAD * inline [
Date];
ALIAS Time as Date;


Concatenate (CsvData)
LOAD *
FROM c:\Data\*.csv (text.....)
;

Note that the order of columns in a source file is not important, the name of the field are.