Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Coming your way, the Qlik Data Revolution Virtual Summit. October 27-29. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor II
Contributor II

Brackets in file name causing load to fail

I am trying to loop through a directory and load all the files within it. Its a simply bit of code, however if one of the filenames contain brackets (), the load will fail. Is there anyway to stop this happening, either by escaping certain characters or changing the load method?

 

 

for each FoundFile in filelist ('lib://Filelocation\*.xlsx')

Input:
LOAD
Field1,
Field2
FROM $(FoundFile)
(ooxml, embedded labels, table is Sheet1);

next FoundFile;

 

 

 

Many thanks!

Rob

Labels (1)
2 Solutions

Accepted Solutions
Highlighted
MVP & Luminary
MVP & Luminary

Try it in this way:

for each FoundFile in filelist ('lib://Filelocation\*.xlsx')

Input:
LOAD
Field1,
Field2
FROM [$(FoundFile)]
(ooxml, embedded labels, table is Sheet1);

next FoundFile;

- Marcus

View solution in original post

Highlighted

Try by adding single quotes around the variable name after FROM

FOR Each FoundFile in filelist ('P:\Com\Test Loop With Parenthesis\Test\*.xlsx')

	Input:
	LOAD Field1, Field2
	FROM '$(FoundFile)'
	(ooxml, embedded labels, table is Sheet1);

NEXT FoundFile;

View solution in original post

3 Replies
Highlighted
MVP & Luminary
MVP & Luminary

Try it in this way:

for each FoundFile in filelist ('lib://Filelocation\*.xlsx')

Input:
LOAD
Field1,
Field2
FROM [$(FoundFile)]
(ooxml, embedded labels, table is Sheet1);

next FoundFile;

- Marcus

View solution in original post

Highlighted

Try by adding single quotes around the variable name after FROM

FOR Each FoundFile in filelist ('P:\Com\Test Loop With Parenthesis\Test\*.xlsx')

	Input:
	LOAD Field1, Field2
	FROM '$(FoundFile)'
	(ooxml, embedded labels, table is Sheet1);

NEXT FoundFile;

View solution in original post

Highlighted
Contributor II
Contributor II

Thanks guys, both solutions worked perfectly!