Loading data from multiple xls-files from folder with subfolder

    This is code snippet is able to load a bunch of xls-files with the same data format but with different file-names, even perhaps with different sheet-names and located in a folder with subfolder(s).

     

    It´s based on this thread from the archive. Thanks to the anonymous user. [;)]

     

    SUB DoDir (Root)
    
    FOR each File in filelist(Root& '\*.xls')
    
    LOAD
    
    value1,
    
    value2,
    
    value3
    
    FROM [$(File)] (biff, embedded labels); //by leaving the part of naming the table it uses all tables of the file
    
    NEXT File
    
    
    FOR each Dir in dirlist (Root&'\*')
    
    CALL DoDir(Dir)
    
    NEXT Dir
    
    END SUB
    
    CALL DoDir('c:\test')
    
    

     

    By modifying the code you will be able to load mutiple files in other file formats like csv and so on.