Discussion board where members can learn more about Qlik Sense App Development and Usage.
I have the Qlik Sense Desktop version and I have this in my script:
Subfield(Proyecto, '-', 1)as Proyecto,
Subfield (Proyecto, '-', 2) as Job,
"F registro" as "Fecha Registro",
Categoria1 as Facturable,
FROM [lib://audit con/archivos\No104.xls]
(biff, embedded labels, header is 1 lines, table is sheet1$);
As you can see. I'm renaming fields and creating Subfields.
In my original script there are over 20 excels that I had to do those changes to each LOAD. How can I do it once and make it apply to all the excels I have in the script?
Thank you in advance.
Go to Solution.
You can write a subroutine for this task.
For Each File in filelist (Root&'\*.*')
if right('$(File)',3)='xls' then
The script read all xls file in a directory given at parameter, regardless of filename.
Is each of the excels files the same structure ? i.e. same fields ! and same worksheet name !
If so and the only difference is the file name, then you can wildcard * the file name like the below example...
FROM [lib://audit con/archivos\No*.xls] (biff, embedded labels, header is 1 lines, table is sheet1$);
All the Excel files will load using the same structure you have designed in the script....
If there is only a single sheet per workbook then you can leave the sheet spec out of the line e.g.
FROM [lib://audit con/archivos\No*.xls] (biff, embedded labels, header is 1 lines);
Yes, all the excels have the same structure and the same sheet name. The only difference is the Excel name but sometimes the excels don't have "No" as start name, they have characters...
Name as 123Name
FROM [lib://audit con/archivos\SinArchivo.xls]
If I want "Name" to be "123Name" in both loads, where I am suppose to add that sentence in the script?
Your code above is correct, as file names differ then you will need a separate load script as you show in your example.
Would there be major disruption if you rename the file just for the load , not the best solution I know, but unfortunately this is this downside of multi file ETL.
Thank you Undergrinder.