Skip to content

Instantly share code, notes, and snippets.

@tanaka-takayoshi
Created July 23, 2012 00:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tanaka-takayoshi/3161460 to your computer and use it in GitHub Desktop.
Save tanaka-takayoshi/3161460 to your computer and use it in GitHub Desktop.
Extract attached media files from an xlsx file
$sh = new-object -com shell.application
$path = $args[0]
$targetfolder = Split-Path $path -parent
$zipFile = [System.IO.Path]::ChangeExtension($path,".zip")
Copy-Item $path $zipFile
$sh.namespace($zipFile).ParseName("xl\media\") | % { $sh.namespace($targetfolder).copyhere($_.Path) }
Remove-Item $zipFile
Join-Path $targetfolder "media" | Invoke-Item
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment