DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Loading excel file into database using SQL Loader

  1. #1
    Join Date
    Mar 2001
    Location
    Reading, U.K
    Posts
    598

    Loading excel file into database using SQL Loader

    Hi All,

    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

    Please help.
    Cheers!
    OraKid.

  2. #2
    Join Date
    Mar 2001
    Location
    Reading, U.K
    Posts
    598
    I got a solution throught a VB script. This might be helpful to all...

    http://www.computing.net/answers/pro...csv/16265.html

    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.


    Cheers,
    Cheers!
    OraKid.

  3. #3
    Join Date
    Jul 2008
    Posts
    1

    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)

    load data
    infile *
    truncate
    into table testCSV
    fields terminated by ',' optionally enclosed by '"'
    {
    filed1 char,
    field2 char,
    }
    Begindata
    data,data
    da,da

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width