{"id":7207,"date":"2016-08-18T10:39:13","date_gmt":"2016-08-18T01:39:13","guid":{"rendered":"https:\/\/www.ka-net.org\/blog\/?p=7207"},"modified":"2016-08-18T16:52:13","modified_gmt":"2016-08-18T07:52:13","slug":"powershell%e3%81%8b%e3%82%89netoffice%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6excel%e3%82%92%e6%93%8d%e4%bd%9c%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/www.ka-net.org\/blog\/?p=7207","title":{"rendered":"PowerShell\u304b\u3089NetOffice\u3092\u4f7f\u3063\u3066Excel\u3092\u64cd\u4f5c\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"<p>\u5148\u65e5\u3001Excel MVP\u306e<a href=\"https:\/\/twitter.com\/kiyotoi?lang=ja\" title=\"Kiyoto ITO(@kiyotoi)\u3055\u3093\" target=\"_blank\">\u4f0a\u85e4\u3055\u3093<\/a>\u304c<a href=\"http:\/\/www.relief.jp\/itnote\/archives\/powershell-save-excel-file.php\" title=\"PowerShell\u3067Excel\u30d5\u30a1\u30a4\u30eb\u3092\u4e0a\u66f8\u304d\u4fdd\u5b58\u3059\u308b:\u30a8\u30af\u30bb\u30eb\u30de\u30af\u30ed\u30fbExcel VBA\u306e\u4f7f\u3044\u65b9-Workbook\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\" target=\"_blank\">PowerShell\u304b\u3089Excel\u30d5\u30a1\u30a4\u30eb\u3092\u4e0a\u66f8\u304d\u4fdd\u5b58\u3059\u308b\u65b9\u6cd5<\/a>\u306b\u3064\u3044\u3066\u3001\u30d6\u30ed\u30b0\u3067\u8a18\u4e8b\u3092\u66f8\u304b\u308c\u3066\u3044\u307e\u3057\u305f\u3002<\/p>\n<p>\u3053\u306e\u8a18\u4e8b\u3067\u3082\u89e6\u308c\u3089\u308c\u3066\u3044\u307e\u3059\u304c\u3001.NET\u304b\u3089Excel\u3092\u6271\u3046\u5834\u5408(Microsoft.Office.Interop.Excel)\u306b\u306f\u3001\u53c2\u7167\u3057\u305fCOM\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u89e3\u653e(ReleaseComObject)\u6f0f\u308c\u304c\u3042\u308b\u3068<span style=\"color: #ff0000; font-weight: bold;\">\u30d7\u30ed\u30bb\u30b9\u304c\u6b8b\u308a\u7d9a\u3051\u308b<\/span>\u554f\u984c\u304c\u3042\u308a\u3001\u4e0a\u624b\u304f\u51e6\u7406\u3059\u308b\u305f\u3081\u306b\u306f\u9762\u5012\u306a\u5f8c\u7247\u4ed8\u3051\u304c\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n(\u3053\u306e\u554f\u984c\u306b\u3064\u3044\u3066\u306f\u3001Qiita\u306b\u3042\u308b<a href=\"http:\/\/qiita.com\/midori44\/items\/acab9106e6dad9653e73\" title=\"Excel\u30d5\u30a1\u30a4\u30eb\u3092 C# \u3068 VB.NET \u3067\u8aad\u307f\u8fbc\u3080 \u6b63\u3057\u3044 \u65b9\u6cd5 - Qiita\" target=\"_blank\">\u3053\u3061\u3089\u306e\u8a18\u4e8b<\/a>\u306e\u89e3\u8aac\u304c\u5206\u304b\u308a\u3084\u3059\u304b\u3063\u305f\u3067\u3059\u3002)<\/p>\n<p>\u3053\u308c\u306b\u5bfe\u3059\u308b\u4e00\u3064\u306e\u89e3\u6c7a\u7b56\u3068\u3057\u3066\u300c<a href=\"http:\/\/netoffice.codeplex.com\/\" title=\"NetOffice - MS Office in .NET (proudly presents on Codeplex only) - Home\" target=\"_blank\">NetOffice<\/a>\u300d\u304c\u3042\u308a\u3001\u5f53\u30d6\u30ed\u30b0\u3067\u3082\u7d39\u4ecb(\u4e0b\u8a18\u30ea\u30f3\u30af\u53c2\u7167)\u3057\u305f\u3053\u3068\u304c\u3042\u308b\u306e\u3067\u3059\u304c\u3001\u4eca\u56de\u306f\u3053\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u30fc\u3092PowerShell\u304b\u3089\u4f7f\u3063\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<div class=\"cardlink\"><a href=\"https:\/\/www.ka-net.org\/blog\/?p=2246\"><div class=\"cardlink_thumbnail\"><img src='https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-Other-120x120.png' alt='\u300cNetOffice\u300d\u3067\u7c21\u5358\u306b.NET\u304b\u3089Office\u3092\u64cd\u4f5c' width=120 height=120 \/><\/a><\/div><div class=\"cardlink_content\"><span class=\"timestamp\">2012.09.11<\/span><div class=\"cardlink_title\"><a href=\"https:\/\/www.ka-net.org\/blog\/?p=2246\">\u300cNetOffice\u300d\u3067\u7c21\u5358\u306b.NET\u304b\u3089Office\u3092\u64cd\u4f5c <\/a><\/div><div class=\"cardlink_excerpt\">\u30cd\u30c3\u30c8\u3067\u300cNetOffice\u300d\u306a\u308b\u30c4\u30fc\u30eb\u304c\u3042\u308b\u3053\u3068\u3092\u77e5\u3063\u305f\u306e\u3067\u3001\u65e9\u901f\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\u3002\r\nCodePlex\u306e\u30da\u30fc\u30b8\u306b\u3088\u308b\u3068\u3001Microsoft Office\u88fd\u54c1\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u305f\u3081\u306e.NET\u30e9\u30c3\u30d1\u30fc\u30a2\u30bb\u30f3\u30d6\u30ea\u306e\u3088\u3046\u3067\u3001Office\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u306b\u95a2\u4fc2\u306a\u304f\u7c21\u5358\u306b\u30b3\u30fc\u30c9...<\/div><\/div><div class=\"cardlink_footer\"><\/div><\/div>\n<h4 class=\"style4a\">\u4e0b\u6e96\u5099<\/h4>\n<p>\u307e\u305a\u306fNetOffice\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u306e\u3067\u3059\u304c\u3001<a href=\"http:\/\/netoffice.codeplex.com\/releases\/view\/70943\" title=\"NetOffice - MS Office in .NET (proudly presents on Codeplex only) - Download: NetOffice 1.7.3\" target=\"_blank\">Codeplex<\/a>\u304b\u3089\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u308b\u306e\u3067\u3059\u304c\u3001Excel\u5358\u54c1\u306e\u5834\u5408\u306f<a href=\"https:\/\/www.nuget.org\/packages\/NetOffice.Excel\/1.7.3\" title=\"NuGet Gallery | NetOffice.Excel 1.7.3\" target=\"_blank\">NuGet<\/a>\u304b\u3089\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305f\u65b9\u304c\u304a\u624b\u8efd\u3067\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">nuget install NetOffice.Excel<\/pre>\n<h4 class=\"style4a\">NetOffice\u3067Excel\u3092\u64cd\u4f5c\u3059\u308b\u30b3\u30fc\u30c9<\/h4>\n<p>NetOffice\u306e\u6e96\u5099\u304c\u3067\u304d\u305f\u3089\u3001\u3044\u3088\u3044\u3088PowerShell\u3067\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">&#x5B;void]&#x5B;Reflection.Assembly]::LoadFile(&quot;C:\\System\\NetOffice\\NetOffice.dll&quot;)\r\n&#x5B;void]&#x5B;Reflection.Assembly]::LoadFile(&quot;C:\\System\\NetOffice\\OfficeApi.dll&quot;)\r\n&#x5B;void]&#x5B;Reflection.Assembly]::LoadFile(&quot;C:\\System\\NetOffice\\ExcelApi.dll&quot;)\r\n&#x5B;void]&#x5B;Reflection.Assembly]::LoadFile(&quot;C:\\System\\NetOffice\\VBIDEApi.dll&quot;)\r\n$xls = New-Object NetOffice.ExcelApi.Application\r\n$xls.Visible = $true\r\n$wb = $xls.Workbooks.Open(&quot;C:\\Test\\Sample.xlsx&quot;)\r\n$wb.Worksheets&#x5B;1].Range(&quot;A1&quot;).Value = (Get-Date).ToString(&quot;yyyy\/MM\/dd HH:mm:ss&quot;)\r\n$wb.Save()\r\nStart-Sleep -s 10 #\u3053\u306e\u9593\u306b\u30bf\u30b9\u30af\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u3067\u30d7\u30ed\u30bb\u30b9\u76e3\u8996\r\n$wb.Close()\r\n$xls.Quit()\r\n$xls.Dispose()<\/pre>\n<p>\u30d6\u30c3\u30af\u3092\u958b\u3044\u3066\u30bb\u30eb\u306b\u65e5\u4ed8\u30fb\u6642\u523b\u3092\u66f8\u304d\u8fbc\u3080\u51e6\u7406\u3067\u3059\u304c\u3001\u5b9f\u306b\u30b7\u30f3\u30d7\u30eb\u3067\u3059\u3002<br \/>\n\u9762\u5012\u306a\u5f8c\u7247\u4ed8\u3051\u306fDispose\u30e1\u30bd\u30c3\u30c9\u3067NetOffice\u5074\u304c\u3084\u3063\u3066\u304f\u308c\u3066\u3044\u308b(\u305f\u3076\u3093\u305d\u306e\u306f\u305a)\u306e\u3067\u3001\u81ea\u5206\u3067\u51e6\u7406\u3092\u66f8\u304f\u5fc5\u8981\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<h4 class=\"style4a\">\u304a\u308f\u308a\u306b<\/h4>\n<p><a href=\"http:\/\/qiita.com\/midori44\/items\/acab9106e6dad9653e73\" title=\"Excel\u30d5\u30a1\u30a4\u30eb\u3092 C# \u3068 VB.NET \u3067\u8aad\u307f\u8fbc\u3080 \u6b63\u3057\u3044 \u65b9\u6cd5 - Qiita\" target=\"_blank\">\u3053\u306e\u8a18\u4e8b<\/a>\u306b\u3088\u308b\u3068NetOffice\u3067\u3082\u89e3\u653e\u6f0f\u308c\u304c\u767a\u751f\u3059\u308b\u3089\u3057\u3044\u3067\u3059\u304c\u3001\u305d\u308c\u3067\u3082\u697d\u306b\u30b3\u30fc\u30c9\u3092\u66f8\u3051\u308b\u70b9\u306f\u9b45\u529b\u7684\u3067\u3059\u3002<\/p>\n<p>\u3057\u304b\u3082NetOffice\u306e\u5834\u5408\u306f\u3001Excel\u306b\u9650\u3089\u305aWord\u3084PowerPoint\u3001Outlook\u3084Access\u306b\u307e\u3067\u5bfe\u5fdc\u3057\u3066\u3044\u308b\u306e\u3067\u3001\u6d3b\u7528\u3067\u304d\u308b\u5834\u9762\u306f\u591a\u3044\u3060\u308d\u3046\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u3082\u3061\u308d\u3093\u3001\u4e8b\u524d\u306b\u5404Office\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u304c\u5fc5\u9808\u306b\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u304c\u3001\u975e\u5e38\u306b\u4fbf\u5229\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u30fc\u306a\u306e\u3067\u8208\u5473\u304c\u3042\u308b\u65b9\u306f\u662f\u975e\u89e6\u3063\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<hr \/>\n<p>Word\u3084PowerPoint\u3092\u64cd\u4f5c\u3059\u308b\u30b3\u30fc\u30c9\u306b\u3064\u3044\u3066\u3082\u8a18\u4e8b\u3092\u66f8\u304d\u307e\u3057\u305f\u3002<\/p>\n<div class=\"cardlink\"><a href=\"https:\/\/www.ka-net.org\/blog\/?p=7211\"><div class=\"cardlink_thumbnail\"><img src='https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-Office-120x120.png' alt='PowerShell\u304b\u3089NetOffice\u3092\u4f7f\u3063\u3066Word\u3084PowerPoint\u3092\u64cd\u4f5c\u3059\u308b\u65b9\u6cd5' width=120 height=120 \/><\/a><\/div><div class=\"cardlink_content\"><span class=\"timestamp\">2016.08.18<\/span><div class=\"cardlink_title\"><a href=\"https:\/\/www.ka-net.org\/blog\/?p=7211\">PowerShell\u304b\u3089NetOffice\u3092\u4f7f\u3063\u3066Word\u3084PowerPoint\u3092\u64cd\u4f5c\u3059\u308b\u65b9\u6cd5 <\/a><\/div><div class=\"cardlink_excerpt\">\u524d\u56de\u306e\u8a18\u4e8b\u95a2\u9023\u3067\u3001\r\n\r\nWord\u3084PowerPoint\u3082\u30c9\u30f3\u3068\u3053\u3044\u3067\u3059\u3002 [PowerShell\u304b\u3089NetOffice\u3092\u4f7f\u3063\u3066Excel\u3092\u64cd\u4f5c\u3059\u308b\u65b9\u6cd5] https:\/\/t.co\/kAm2EcZukH pic.twitter.com\/e943LhO5Vh&m...<\/div><\/div><div class=\"cardlink_footer\"><\/div><\/div>\n","protected":false},"excerpt":{"rendered":"\u5148\u65e5\u3001Excel MVP\u306e\u4f0a\u85e4\u3055\u3093\u304cPowerShell\u304b\u3089Excel\u30d5\u30a1\u30a4\u30eb\u3092\u4e0a\u66f8\u304d\u4fdd\u5b58\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u3001\u30d6\u30ed\u30b0\u3067\u8a18\u4e8b\u3092\u66f8\u304b\u308c\u3066\u3044\u307e\u3057\u305f\u3002 \u3053\u306e\u8a18\u4e8b\u3067\u3082\u89e6\u308c\u3089\u308c\u3066\u3044\u307e\u3059\u304c\u3001.NET\u304b\u3089Excel\u3092\u6271\u3046\u5834\u5408(Micros [&hellip;]","protected":false},"author":1,"featured_media":7111,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"Word\u3084PowerPoint\u3082\u30c9\u30f3\u3068\u3053\u3044\u3067\u3059\u3002 [PowerShell\u304b\u3089NetOffice\u3092\u4f7f\u3063\u3066Excel\u3092\u64cd\u4f5c\u3059\u308b\u65b9\u6cd5]","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4,48,94],"tags":[],"class_list":["post-7207","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-office","category-excel-office","category-powershell"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-Excel.png","jetpack_shortlink":"https:\/\/wp.me\/p4UZZr-1Sf","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/7207","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7207"}],"version-history":[{"count":6,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/7207\/revisions"}],"predecessor-version":[{"id":7215,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/7207\/revisions\/7215"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/media\/7111"}],"wp:attachment":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7207"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7207"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7207"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}