Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
anuradhaa
Partner - Creator II
Partner - Creator II

Get dynamical column in excel export

In  CSV one colum is unavailable in some times,

is it possible to add if condition in script to load data of that colum when it's available in CSV . i use below syntax but doesn't work

if(len([ID])=0,' ',[ID]) as [ID],

4 Replies
PradeepReddy
Specialist II
Specialist II

try to use the statement..

Load * from source.csv;

anuradhaa
Partner - Creator II
Partner - Creator II
Author

No, i want to have column names

marcus_sommer

It's not possible to check if a field is available from inside of a load-statement. You will always need to have additionally steps to check from outside for example with a filelist-loop, like here: Re: Import files one at a time, check for fields, and overwrite existing files or you need a forced concatenation like this one:

YourTable:

Load '' as ID autogenerate 0;

     concatenate(YourTable)

Load * From YourCSV.csv;

- Marcus

tamilarasu
Champion
Champion

Try the below one,

Temp:

Noconcatenate First 1 LOAD *

FROM

[Test.xlsx]

(ooxml, embedded labels, table is Sheet1);

If FieldNumber('Field3','Temp') > 0 Then

    LET vField = 'Field3';

Else

    LET vField = Chr(39)&Chr(39);

End if

Drop Table Temp;

LOAD

  Field1,

  Field2,

  $(vField) as F3

from Test.xlsx]

(ooxml, embedded labels, table is Sheet1);