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: 
Anonymous
Not applicable

Load all tables from directory

Hi,

i want to load always all tables from a directory, even if there new tables or tables were deleted.

This is an example for a folder structure:

MainFolder

       SubFolderr1

                      File1

                      File2

       SubFolder2

                      File3

                      File4

       SubFolder3

                      File5

                      File6

How can i load always all tables from MainFolder regardless of new filename´s or files wich were deleted?

regards,

Fritz

13 Replies
undergrinder
Specialist II
Specialist II

2016-05-04 13_42_06-Qlik Sense Desktop.png

  • Click new connection from the right pane in data load editor
  • Select folder option
  • Select the desired directory, and give name to the connection
  • You can refer to this connection like this: lib://connection name
  • The connection may have subdirectories, so this is a valid reference too: lib://connection name/subdirectory
  • Achieve particular file: ib://connection name/subdirectory\File.xlsx

If you are using server version of Sense be careful with connection name, because the user name will be automate concatenate to connection name like this: lib://connection name (user name).

The user name is deletable from QMC.

Hope this help.

G.

Anonymous
Not applicable
Author

I did it like you describe. I get always this error:

Error: File extdata.cpp, Line 2279: FileList: Concatenate LOAD *,...


But only if i load a xlsx file. If i load a csv file it works.


For csv i use this code:

FROM [$(Datei)] (txt, codepage is 1252, embedded labels, delimiter is ',', msq, header is 2 lines);

For xlsx this code:

FROM [$(Datei)] (ooxml, embedded labels, table is test));


regards,

René

Anonymous
Not applicable
Author

This script runs:

Set vConcatenate = ;

sub ScanFolder(Root)

for each FileExtension in 'csv','xlsx'

  if FileExtension = 'csv' then

  

  for each Datei in filelist( Root & '\*.' & FileExtension)

 

  FileList:

  $(vConcatenate)

 

  LOAD *, '$(Datei)' as SourceFile

  FROM [$(Datei)] (txt, codepage is 1252, embedded labels, delimiter is ',', msq, header is 2 lines);

 

  Set vConcatenate = Concatenate;

  next Datei

 

  elseif FileExtension = 'xlsx' then

  

  for each Datei in filelist( Root & '\*.' & FileExtension)

  

  FileList:

  $(vConcatenate)

  LOAD *, '$(Datei)' as SourceFile

  FROM [$(Datei)] (ooxml, embedded labels);

  

  Set vConcatenate = Concatenate;

  next Datei

  

  end if

next FileExtension

  for each SubDirectory in dirlist( Root & '\*' )

  call ScanFolder(SubDirectory)

  next SubDirectory

end sub

Call ScanFolder('C:\work');

undergrinder
Specialist II
Specialist II

Hi Walter,

Add an excel  from wizard, then copy that code from it.

FROM [$(Datei)] (ooxml, embedded labels)

It could be more parameter, like table name, how many rows should be skipped.


It can be different columns in files. XLSX may have @A @B .. columns due to the used columns property of workbook.


I suggest you run your script at debug mode, and dwelve into your files.


G.