Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
Can any one please let me know option to load multiple excel sheets(Having multiple sheets) with out using ODBC connection
share the sample app and the excel files ...Is the app running fine in local ?
In local system while reloading its throwing an error" _xlnm#_FilterDatabase."
changed the file format to .xls and tried but no luck
Share the sample app and excel let me check once
You can use a macro to get the sheet names:
VB Macro:
function GetSheetNames(pExcelFile)
set ExApp = CreateObject("Excel.Application")
ExApp.Visible = False
set ExWrk = ExApp.Workbooks.Open(pExcelFile)
s = ""
for i = 1 to ExWrk.Sheets.Count
if i = ExWrk.Sheets.Count then
s = s + "'" + ExWrk.Sheets(i).Name + "'"
else
s = s + "'" + ExWrk.Sheets(i).Name + "',"
end if
next
ExWrk.Close
ExApp.Quit
GetSheetNames=s
end function
Script:
FOR Each file in FileList('$(Filepath)\*.xlsx');
let sheetNames=GetSheetNames('$(file)');
FOR Each sheetName in $(sheetNames)
If Wildmatch('$(sheetName)', 'Region*','Area*') Then
Table:
Load *
From $(file)(ooxml, embedded labels, table is [$(sheetName)]);
end if
next
next file
Read this thread
ODBC 64 giving an "architecture mismatch" error
Hi Sasi,
Have you tried to add "IF" statement like I said yesterday? Looks like you haven't try.. Let me try for you.
**Just change the file path
FOR EACH file in FileList('Filepath\*.xlsx');
ODBC CONNECT32 TO [Excel Files;DBQ=$(file)];
tables:
SQLtables;
DISCONNECT;
FOR i = 0 to NoOfRows('tables')-1
Let vSheetName = Replace(Peek('TABLE_NAME', $(i), 'tables'),chr(39),'');
If(WildMatch(vSheetName,'*$')) Then
LET vSheetName = Replace(Replace(Peek('TABLE_NAME', $(i), 'tables'),'$',''),chr(39),'');
If Wildmatch(vSheetName, 'Region*','Area*') Then
Table:
Load *
From $(file)(ooxml, embedded labels, table is [$(vSheetName)]);
ENDIF
ENDIF
NEXT i
Drop table tables;
Next file
Hi Nagaraj,
thank you so much using ODBC i'm looking for similar if condition as well.
But now identified one more issue is that "File extdata.cpp, Line 2291". can please let me know any reason for these kind of issues
Sasi - Could you post your log file here?
Hi Nagaraj,
can please let me know any alternative other than using ODBC connection.
Because in our server we don't have an excel driver and so.