Question Powershell création tableau croisé dynamique

Plus d'informations
il y a 13 ans 3 mois #13140 par JJ
Bonjour, je cherche à créer un tableau croisé dynamique sur excel grâce à powershell,
Sauriez-vous comment faire cela en automation ou autre comme en injectant une macro VBA et en l’exécutant ?
Merci d’avance

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 13 ans 3 mois #13146 par Matthew BETTON

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 13 ans 3 mois #13154 par JJ
Merci j'ai trouvé également ce PowerShell qui semble très intéressant et adéquate, mais il n'arrive qu'à ouvrir 3 mêmes fichiers XLS avec un tableau simple dans le deuxième onglet, et j'ai une pleins d'erreurs, les voici ci dessous:

PS: je suis sur powerShell 3 et l'ai exécuté à partir de l'exemple sur le lien que vous m'avez donné avec PowerShell ISE

[code:1]

Exception lors de l'appel de « CreatePivotTable » avec « 1 » argument(s) : « Paramètre incorrect. (Exception de HRESULT : 0x80070057 (E_INVALIDARG)) »
Au caractère C:\Windows\system32\Out-ExcelPivotTable.ps1:66 : 2
+ $PivotTable.CreatePivotTable(\"Sheet1!R1C1\") | out-null
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ComMethodTargetInvocation

Exception lors de l'appel de « PivotTables » avec « 1 » argument(s) : « La méthode PivotTables de la classe Worksheet a échoué. »
Au caractère C:\Windows\system32\Out-ExcelPivotTable.ps1:69 : 3
+ $PivotFields = $Sheet1.PivotTables(\"PivotTable1\").PivotFields($columnFields)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ComMethodTargetInvocation

Propriété « Orientation » introuvable dans cet objet. Assurez-vous qu’elle existe et qu’elle peut être définie.
Au caractère C:\Windows\system32\Out-ExcelPivotTable.ps1:70 : 3
+ $PivotFields.Orientation=$xlColumnField
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation : (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound

Exception lors de l'appel de « PivotTables » avec « 1 » argument(s) : « La méthode PivotTables de la classe Worksheet a échoué. »
Au caractère C:\Windows\system32\Out-ExcelPivotTable.ps1:74 : 3
+ $PivotFields = $Sheet1.pivottables(\"PivotTable1\").PivotFields($rowFields)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ComMethodTargetInvocation

Propriété « Orientation » introuvable dans cet objet. Assurez-vous qu’elle existe et qu’elle peut être définie.
Au caractère C:\Windows\system32\Out-ExcelPivotTable.ps1:75 : 3
+ $PivotFields.Orientation=$xlRowField
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation : (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound

Exception lors de l'appel de « PivotTables » avec « 1 » argument(s) : « La méthode PivotTables de la classe Worksheet a échoué. »
Au caractère C:\Windows\system32\Out-ExcelPivotTable.ps1:84 : 3
+ $PivotFields = $Sheet1.pivottables(\"PivotTable1\").PivotFields($values)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ComMethodTargetInvocation

Propriété « Orientation » introuvable dans cet objet. Assurez-vous qu’elle existe et qu’elle peut être définie.
Au caractère C:\Windows\system32\Out-ExcelPivotTable.ps1:85 : 3
+ $PivotFields.Orientation=$xlDataField
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation : (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound

[\code] [/code:1]

Message édité par: bidouilles, à: 29/11/12 15:05

Message édité par: bidouilles, à: 29/11/12 15:13<br><br>Message édité par: bidouilles, à: 29/11/12 16:23

Connexion ou Créer un compte pour participer à la conversation.

Temps de génération de la page : 0.043 secondes
Propulsé par Kunena