Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
IgorGol
Contributor III
Contributor III

Error with Loading xlsx files

Hi,

I have to files : Release 1 , Release 2 (xlsx) in folder

 

When I write vFileYear =1 or vFileYear = 2 it works , but when I try : vFileYear = Trim(Right(Left(file, 9), 1))

it's not working. any suggestion ?


LET vFilePath = 'lib://Folder_Planning_Control/Release';
FOR EACH file in FileList('$(vFilePath)/*.xlsx');
LET vFileYear = Trim(Right(Left(file, 9), 1));

NEXT

Data:
LOAD *
FROM

[lib://Folder_Planning_Control/Release/Release $(vFileYear).xlsx]
(ooxml, embedded labels, table is 'Page 1');

1 Solution

Accepted Solutions
_ylc
Partner - Creator
Partner - Creator

Your vFileYear returning value is with the file path.

Example

vFilePath = lib://Folder_Planning_Control/Release

file = lib://Folder_Planning_Control/Release/Release 1.xlsx

Left(file,9) =lib://Fol

Right(Left(file,9),1) = l

With that, the output is wrong.

View solution in original post

3 Replies
_ylc
Partner - Creator
Partner - Creator

Your vFileYear returning value is with the file path.

Example

vFilePath = lib://Folder_Planning_Control/Release

file = lib://Folder_Planning_Control/Release/Release 1.xlsx

Left(file,9) =lib://Fol

Right(Left(file,9),1) = l

With that, the output is wrong.

IgorGol
Contributor III
Contributor III
Author

thanks!

 

how should I write this?

_ylc
Partner - Creator
Partner - Creator

You can try this:

right(left(SubField(vFile, '/', 5),9),1)