Loading excel file into database using SQL Loader
I need to load the data available in an excel into the database using the SQL Loader.
Since we get the excel from external 3rd party who are not ready to give us in a CSV format, I am forced to look into an option of changing the excel files into CSV format. Is there anyway I can load the files using SQL Loader? OR do you ahve any codes
I got a solution throught a VB script. This might be helpful to all...
Okay, to make this easy, I made this as a VBScript. It'll open every .xls file in the directory, then save it as ..csv:
Dim oFSODim oShell, oExcel, oFile, oSheetSet oFSO = CreateObject("Scripting.FileSystemObject")Set oShell = CreateObject("WScript.Shell")Set oExcel = CreateObject("Excel.Application")oExcel.DisplayAlerts = False For Each oFile In oFSO.GetFolder("C:\").Files If LCase(oFSO.GetExtensionName(oFile)) = "xls" Then With oExcel.Workbooks.Open(oFile, 0, True, , , , True, , , , False, , False) For Each oSheet In .Worksheets oSheet.SaveAs ".\" & oFile.Name & "." & oSheet.Name, 6 Next .Close False, , False End With End IfNextoExcel.QuitoShell.Popup "Conversion complete", 10
The first red part (the C:\) is where the script will look for files.
The second red part (the .) is where the script will save the sheets.
loading csv using sql loader
with sql loader its quit simple
i m giving you a test control file for help
suppose ur table has two fields (field1,field2)
into table testCSV
fields terminated by ',' optionally enclosed by '"'
Click Here to Expand Forum to Full Width