Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
_Lp
Contributor II
Contributor II

Load multiple csv files with for each loop

Hi,

I'm trying to load mutiple csv files from a folder.

But the value of my file variable remains null.However, the path is correct. Is it the FileList function that I'm using incorrectly ?

Here is my code :

For each File in FileList(vFileName & '*' & '.csv')

Load *

From[$(File)]
(txt, codepage is 28591, embedded labels, delimiter is ';', no quotes);

Next File

Regards,

LP

Labels (3)
1 Solution

Accepted Solutions
marcus_sommer

Quite usually the specified path is not valid - you should check it very carefully maybe by copying the path from the explorer into a txt-file and putting your expanded variable + all used extensions below it. In your case I could for example imagine that you missed a backslash behind your variable or something similar, maybe the following is helpful for you:

For each File in FileList('$(vFileName) & '\*' & '.csv')
   trace $(File);
   Load * From [$(File)] (txt, codepage is 28591, embedded labels, delimiter is ';', no quotes);
Next File

- Marcus

View solution in original post

2 Replies
marcus_sommer

Quite usually the specified path is not valid - you should check it very carefully maybe by copying the path from the explorer into a txt-file and putting your expanded variable + all used extensions below it. In your case I could for example imagine that you missed a backslash behind your variable or something similar, maybe the following is helpful for you:

For each File in FileList('$(vFileName) & '\*' & '.csv')
   trace $(File);
   Load * From [$(File)] (txt, codepage is 28591, embedded labels, delimiter is ';', no quotes);
Next File

- Marcus

_Lp
Contributor II
Contributor II
Author

Thanks for your return.

By copy-pasting the script in a new application, the issue disappeared.

Lp