Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SSIS package to import from Excel
Message
 
General information
Forum:
Microsoft SQL Server
Category:
Import/Export
Miscellaneous
Thread ID:
01684637
Message ID:
01684650
Views:
29
I have another question.

Does this Powershell code require Excel installed or there is another way to get it to work running from the server?
$excelFile = $dir + $excelFileName + ".xlsx"
    $E = New-Object -ComObject Excel.Application
    $E.Visible = $false
    $E.DisplayAlerts = $false
    $wb = $E.Workbooks.Open($excelFile)
    foreach ($ws in $wb.Worksheets)
    {        
        $n = $excelFileName
        if ($ws.Name -like '*Disaster*')
        {
       #     Write-Host 'Sheet Name contains word Disaster'
            $ws.SaveAs($csvLoc + $n + ".csv", 6)
        }
      #  else
      #  {
      #      Write-Host $ws.Name
      #  }
       
         
    }
    $E.Quit()
In other words, may be there is a way to install some extensions only and not the full Excel? Does anyone know?

Thanks in advance.

>Hi Martina,
>
>I tried yesterday to create connection from my 64 bit Windows in VS. I see no drivers to use when I selected new Ole DB connection (only one Jet driver which seems to be for Access)
>
>Can you please guide me how to create a package on Windows 64 laptop using VS 2019 (I'm creating old style dtsx package not using SSIDB)?
>
>Thanks in advance.
>
>>Hi,
>>
>>You can create SSIS package as import from xls(x) within using Microsoft.ACE.OLEDB.12.0 driver.
>>But, if the Microsoft.ACE.OLEDB.12.0 driver inslaled on server with MSSQL, you can use the driver directly:
>>
>>
>>SELECT *
>>  FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0' ,  'Excel 8.0;Database=\\server\file.xlsx;HDR=Yes', 'SELECT * FROM [SheetName$]')
>>  WHERE NOT "Datum do" IS NULL
>>
>>INSERT INTO OPENROWSET('Microsoft.ACE.OLEDB.12.0' , 'Excel 8.0;Database=\\server\file.xlsx;HDR=Yes', 'SELECT * FROM [SheetName$]')
>> SELECT '2017-01-12', '2017-01-13','AAA','BBB',30,'GJ'
>>
>>UPDATE OPENROWSET('Microsoft.ACE.OLEDB.12.0' , 'Excel 8.0;Database=\\server\file.xlsx;HDR=No', 'SELECT * FROM [SheetName$A4:A4]')
>> SET F1=1111
>>
>>
>> MartinaJ
>>
>>>Hi everybody,
>>>
>>>I'm wondering what are my options of using an SSIS package to read data from Excel without having Excel installed on the server? The package is executed as part of the job. Is there an easy way to convert Excel to csv (say, using Powershell script (but without Excel installed, so no COM automation)) or as a .NET script task?
>>>
>>>Do you have ideas?
>>>
>>>Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform