Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
chriys1337
Creator III
Creator III

Drop Fields from an Excel List / Column

Hi,

I need to drop quite some fields from my datamodel and I have listed around 60 fieldnames in an Excel list (colum name: "Name".

Is it possible to drop all these fields in a simple statement using the Excel list?

Thank you,

 

Chris

Labels (1)
1 Reply
Adam_Romanowski
Partner - Creator
Partner - Creator

Some code for you:

 
FieldsToRemove:
LOAD
    Name
FROM [lib://Data/fields_to_remove.xlsx]
(ooxml, embedded labels, table is Testing);



for i=0 to NoOfRows('FieldsToRemove')-1
  let vFieldName=Peek('Name',$(i), 'FieldsToRemove');
  drop field "$(vFieldName)";
next i;
drop table FieldsToRemove;

Change path and sheet name accordingly to your needs!