Création classeur Excel sans office
Bonjour à tous,
Je rencontre quelques problèmes concernant la création du classeur ... Je travail sur un Windows server 2012 x64 sans office d'installé.
J'ai installé "AccessDatabaseEngine_x64.exe" pour me permettre de palier l'installation d'office mais je butte sur la connexion.
Voici mon script :
Code:
1 2 3 4 5 6
| $connstring = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=`"$filename`";Extended Properties=`"Excel 12.0 Macro;HDR=YES`";"
#Création du fichier excel
$excel = New-Object -ComObject System.Data.OleDb.OleDbCommand($connstring)
#$excel.visible = $True #Permet la visualisation du fichier en temps réel
$workbook = $excel.Workbooks.Add() |
Et voici l'erreur retourné :
New-Object : A positional parameter cannot be found that accepts argument 'Provider=Microsoft.ACE.OLEDB.12.0;Data Source="\...";Extended Properties="Excel 12.0 Macro;HDR=YES";'.
At C:\Maintenance\Script\Untitled3.ps1:48 char:10
+ $excel = New-Object -ComObject System.Data.OleDb.OleDbCommand($connstring)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [New-Object], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.NewObjectCommand
Pourriez-vous me conseiller ?
Je débute encore donc si vous pouviez m'expliquer avec des détails ce serait cool :)