Provedl jsem průzkum a našel způsob, jak soubory procházet smyčkou pomocí něčeho takového:
CREATE TABLE #tmp(excelFileName VARCHAR(100));
INSERT INTO #tmp
EXEC xp_cmdshell 'dir /B c:\my\folder\path\';
declare @fileName varchar(100)
While (Select Count(*) From #tmp where excelFileName is not null) > 0
Begin
Select Top 1 @fileName = excelFileName From #tmp
-- OPENROWSET processing goes here, using @fileName to identify which file to use
Delete from #tmp Where excelFileName = @FileName
End
DROP TABLE #tmp