Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
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 - Contributor III
Partner - Contributor III

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!