{"id":11700,"date":"2019-06-07T08:00:55","date_gmt":"2019-06-06T23:00:55","guid":{"rendered":"https:\/\/www.ka-net.org\/blog\/?p=11700"},"modified":"2019-06-07T11:36:15","modified_gmt":"2019-06-07T02:36:15","slug":"excel%e3%82%92%e4%bd%bf%e3%82%8f%e3%81%9a%e3%81%abcsv%e3%81%8b%e3%82%89excel%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%81%ab%e5%a4%89%e6%8f%9b%e3%81%99%e3%82%8bpowershell%e3%82%b3%e3%83%bc%e3%83%89","status":"publish","type":"post","link":"https:\/\/www.ka-net.org\/blog\/?p=11700","title":{"rendered":"Excel\u3092\u4f7f\u308f\u305a\u306bCSV\u304b\u3089Excel\u30d5\u30a1\u30a4\u30eb\u306b\u5909\u63db\u3059\u308bPowerShell\u30b3\u30fc\u30c9"},"content":{"rendered":"<p>CSV\u30d5\u30a1\u30a4\u30eb\u304b\u3089Excel\u30d5\u30a1\u30a4\u30eb\u306b\u5909\u63db\u3059\u308b\u51e6\u7406\u3092\u81ea\u52d5\u5316\u3057\u305f\u3044\u3001Excel\u304c\u4f7f\u7528\u3067\u304d\u308b\u74b0\u5883\u3067\u3042\u308c\u3070\u3001VBA\u3084VBScript\u3092\u4f7f\u7528\u3059\u308c\u3070\u6bd4\u8f03\u7684\u7c21\u5358\u306b\u51e6\u7406\u3067\u304d\u307e\u3059\u304c\u3001Excel\u304c\u7121\u3044\u74b0\u5883\u3067\u306f\u3069\u3046\u3059\u308c\u3070\u826f\u3044\u304b\uff1f<\/p>\n<p>\u4eca\u56de\u306f\u3001\u4e0b\u8a18\u8a18\u4e8b\u3067\u3082\u7d39\u4ecb\u3057\u3066\u3044\u308b\u300c<a href=\"https:\/\/www.nuget.org\/packages\/EPPlus\/\" title=\"NuGet Gallery | EPPlus 4.5.3.1\" target=\"_blank\" rel=\"noopener noreferrer\">EPPlus<\/a>\u300d\u3092\u4f7f\u3063\u3066\u3001Excel\u3092\u4f7f\u308f\u305a\u306bCSV\u304b\u3089Excel\u30d5\u30a1\u30a4\u30eb\u306b\u5909\u63db\u3059\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<div class=\"cardlink\"><a href=\"https:\/\/www.ka-net.org\/blog\/?p=6894\"><div class=\"cardlink_thumbnail\"><img src='https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-Excel-120x120.png' alt='ClosedXML\u3084EPPlus\u3067Excel\u30d5\u30a1\u30a4\u30eb\u3092\u8aad\u307f\u66f8\u304d\u3057\u3066\u307f\u305f\u3002' width=120 height=120 \/><\/a><\/div><div class=\"cardlink_content\"><span class=\"timestamp\">2016.04.15<\/span><div class=\"cardlink_title\"><a href=\"https:\/\/www.ka-net.org\/blog\/?p=6894\">ClosedXML\u3084EPPlus\u3067Excel\u30d5\u30a1\u30a4\u30eb\u3092\u8aad\u307f\u66f8\u304d\u3057\u3066\u307f\u305f\u3002 <\/a><\/div><div class=\"cardlink_excerpt\">\u4eca\u56de\u306e\u8a18\u4e8b\u306e\u767a\u7aef\u306f\u4e0b\u8a18\u306eQiita\u6295\u7a3f\u3002\r\n\r\n\r\n\u30fbExcel\u30d5\u30a1\u30a4\u30eb\u3092 C# \u3068 VB.NET \u3067\u8aad\u307f\u8fbc\u3080 \"\u6b63\u3057\u3044\" \u65b9\u6cd5 - Qiita\r\nhttp:\/\/qiita.com\/midori44\/items\/acab9106e6dad9653e73\r\n\r\n...<\/div><\/div><div class=\"cardlink_footer\"><\/div><\/div>\n<h4 class=\"style4a\">Excel\u3092\u4f7f\u308f\u305a\u306bCSV\u304b\u3089Excel\u30d5\u30a1\u30a4\u30eb\u306b\u5909\u63db\u3059\u308bPowerShell\u30b3\u30fc\u30c9<\/h4>\n<p>\u540c\u69d8\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u300c<a href=\"https:\/\/www.nuget.org\/packages\/ClosedXML\/0.95.0-beta1\" title=\"NuGet Gallery | ClosedXML 0.95.0-beta1\" target=\"_blank\" rel=\"noopener noreferrer\">ClosedXML<\/a>\u300d\u3082\u3042\u308a\u307e\u3059\u304c\u3001\u4eca\u56de\u306f<span style=\"color: #ff0000; font-weight: bold;\">EPPlus<\/span>\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<br \/>\n\u4e8b\u524d\u306b<a href=\"https:\/\/www.nuget.org\/packages\/EPPlus\/\" title=\"NuGet Gallery | EPPlus 4.5.3.1\" target=\"_blank\" rel=\"noopener noreferrer\">NuGet<\/a>\u304b\u3089\u30d5\u30a1\u30a4\u30eb(EPPlus.dll)\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">$csv_path = &quot;C:\\Test\\SampleCSV.csv&quot; #CSV\u30d5\u30a1\u30a4\u30eb\u306e\u30d1\u30b9\r\n\r\n&#x5B;void]&#x5B;System.Reflection.Assembly]::LoadFile(&quot;C:\\System\\EPPlus\\EPPlus.dll&quot;) #DLL\u8aad\u307f\u8fbc\u307f\r\n\r\n#\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u8a2d\u5b9a\r\n$format = New-Object OfficeOpenXml.ExcelTextFormat\r\n$format.Encoding = &#x5B;System.Text.Encoding]::GetEncoding(&quot;Shift_JIS&quot;) #CSV\u30d5\u30a1\u30a4\u30eb\u306e\u6587\u5b57\u30b3\u30fc\u30c9\u6307\u5b9a\r\n$format.Delimiter = ',' #\u533a\u5207\u308a\u6587\u5b57\r\n$format.TextQualifier = '&quot;' #\u56f2\u307f\u6587\u5b57\r\n$locale = &#x5B;System.Threading.Thread]::CurrentThread.CurrentCulture.ToString()\r\n$ci = New-Object -TypeName System.Globalization.CultureInfo -ArgumentList $locale\r\n$ci.NumberFormat.NumberDecimalSeparator = ',' #\u6841\u533a\u5207\u308a\u6587\u5b57\r\n$format.Culture = $ci\r\n\r\n#CSV\u8aad\u8fbc\r\n$package = New-Object OfficeOpenXml.ExcelPackage\r\n$sheet = $package.Workbook.Worksheets.Add('Sheet1')\r\n$sheet.Cells.Style.Font.Name = &quot;\uff2d\uff33 \uff30\u30b4\u30b7\u30c3\u30af&quot;\r\n$sheet.Column(4).Style.Numberformat.Format = &quot;#,##0_ &quot; #\u6570\u5024\u5217\u306e\u66f8\u5f0f\u8a2d\u5b9a\r\n$sheet.Column(5).Style.Numberformat.Format = &quot;yyyy\/mm\/dd&quot; #\u65e5\u4ed8\u5217\u306e\u66f8\u5f0f\u8a2d\u5b9a\r\n$in_fi = New-Object -TypeName System.IO.FileInfo -ArgumentList $csv_path\r\n&#x5B;void]$sheet.Cells&#x5B;&quot;A1&quot;].LoadFromText($in_fi, $format)\r\n\r\n#Excel\u30d5\u30a1\u30a4\u30eb\u3092CSV\u30d5\u30a1\u30a4\u30eb\u3068\u540c\u3058\u30d5\u30a9\u30eb\u30c0\u306b\u51fa\u529b\r\n$xlsx_path = &#x5B;System.IO.Path]::Combine(\r\n  &#x5B;System.IO.Path]::GetDirectoryName($csv_path),\r\n  &#x5B;System.IO.Path]::GetFileNameWithoutExtension($csv_path) + &quot;.xlsx&quot;)\r\n$out_fi = New-Object -TypeName System.IO.FileInfo -ArgumentList $xlsx_path\r\n$package.SaveAs($out_fi)\r\n\r\n$package.Dispose()<\/pre>\n<p>\u4e0a\u8a18\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u4e0b\u56f3\u306e\u3088\u3046\u306aCSV\u30d5\u30a1\u30a4\u30eb\u304c<\/p>\n<p><a href=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/PowerShell_EPPlus_01.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/PowerShell_EPPlus_01.jpg\" alt=\"\" width=\"518\" height=\"305\" class=\"alignnone size-full wp-image-11701\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/PowerShell_EPPlus_01.jpg 518w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/PowerShell_EPPlus_01-300x177.jpg 300w\" sizes=\"auto, (max-width: 518px) 100vw, 518px\" \/><\/a><\/p>\n<p>\u4e0b\u56f3\u306e\u3088\u3046\u306aExcel\u30d5\u30a1\u30a4\u30eb\u306b\u5909\u63db\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/PowerShell_EPPlus_02.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/PowerShell_EPPlus_02.jpg\" alt=\"\" width=\"501\" height=\"385\" class=\"alignnone size-full wp-image-11702\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/PowerShell_EPPlus_02.jpg 501w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/PowerShell_EPPlus_02-300x231.jpg 300w\" sizes=\"auto, (max-width: 501px) 100vw, 501px\" \/><\/a><\/p>\n<p>\u6570\u5024\u5217\u3084\u65e5\u4ed8\u5217\u306e\u756a\u53f7\u3092\u6c7a\u3081\u6253\u3061\u3057\u3066\u3044\u308b\u305f\u3081\u3001\u305d\u306e\u3042\u305f\u308a\u306f\u5bfe\u8c61\u30d5\u30a1\u30a4\u30eb\u306b\u3088\u3063\u3066\u5909\u66f4\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u304c\u3001EPPlus\u306f\u30d5\u30a9\u30f3\u30c8\u3082\u542b\u3081\u3066\u7d30\u304b\u304f\u30b9\u30bf\u30a4\u30eb\u3092\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001\u30b3\u30e1\u30f3\u30c8\u3067\u8a18\u8f09\u3057\u3066\u3044\u308b\u901a\u308a\u3001CSV\u30d5\u30a1\u30a4\u30eb\u306e\u6587\u5b57\u30b3\u30fc\u30c9\u3084\u533a\u5207\u308a\u6587\u5b57\u3001\u56f2\u307f\u6587\u5b57\u306e\u6307\u5b9a\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<div id=\"single_banner_area2\" class=\"clearfix one_banner\">\n<div class=\"single_banner single_banner_left\">\n<script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\r\n<!-- \u8a18\u4e8b\u4e2d(\u30c7\u30a3\u30b9\u30d7\u30ec\u30a4\u5e83\u544a\u30e6\u30cb\u30c3\u30c8) -->\r\n<ins class=\"adsbygoogle\"\r\n     style=\"display:block\"\r\n     data-ad-client=\"ca-pub-7306936664602087\"\r\n     data-ad-slot=\"5429724765\"\r\n     data-ad-format=\"auto\"\r\n     data-full-width-responsive=\"true\"><\/ins>\r\n<script>\r\n     (adsbygoogle = window.adsbygoogle || []).push({});\r\n<\/script>\n<\/div>\n<div class=\"single_banner single_banner_right\">\n<a href=\"\" target=\"_blank\"><img decoding=\"async\" src=\"\" alt=\"\" title=\"\" \/><\/a>\n<\/div>\n<\/div>\n\n<p>\u6b63\u76f4\u3001Excel\u3092\u4f7f\u3063\u305f\u65b9\u304c\u624b\u3063\u53d6\u308a\u65e9\u3044\u3068\u306f\u601d\u3044\u307e\u3059\u304c\u3001<i>\u300c\u3044\u3061\u3044\u3061Excel\u3092\u7acb\u3061\u4e0a\u3052\u308b\u306e\u306f\u91cd\u3044\u304b\u3089\u30a4\u30e4\u3060\uff01\u300d<\/i>\u3068\u3044\u3046\u5834\u5408\u306b\u306f\u3001\u30b5\u30fc\u30c9\u30d1\u30fc\u30c6\u30a3\u30fc\u88fd\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3092\u691c\u8a0e\u3057\u3066\u307f\u3066\u306f\u3044\u304b\u304c\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<h4 class=\"style4a\">\u95a2\u9023\u8a18\u4e8b<\/h4>\n<div class=\"cardlink\"><a href=\"https:\/\/www.ka-net.org\/blog\/?p=7187\"><div class=\"cardlink_thumbnail\"><img src='https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-Excel-120x120.png' alt='PowerShell\u304b\u3089ClosedXML\u3092\u4f7f\u3063\u3066Excel\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308b\u65b9\u6cd5' width=120 height=120 \/><\/a><\/div><div class=\"cardlink_content\"><span class=\"timestamp\">2016.08.09<\/span><div class=\"cardlink_title\"><a href=\"https:\/\/www.ka-net.org\/blog\/?p=7187\">PowerShell\u304b\u3089ClosedXML\u3092\u4f7f\u3063\u3066Excel\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308b\u65b9\u6cd5 <\/a><\/div><div class=\"cardlink_excerpt\">\u4ee5\u524dC#\u304b\u3089ClosedXML\u3092\u4f7f\u3063\u3066Excel\u30d5\u30a1\u30a4\u30eb\u3092\u64cd\u4f5c\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u8a18\u4e8b\u3092\u66f8\u304d\u307e\u3057\u305f\u304c(\u4e0b\u8a18\u53c2\u7167)\r\n\u3001\u4eca\u56de\u306fPowerShell\u304b\u3089ClosedXML\u3092\u547c\u3073\u51fa\u3057\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002\r\n\r\n\r\n\r\n\r\n\u203b \u4e0b\u8a18\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3059\u308b\u524d\u306b\u300cClosedXML...<\/div><\/div><div class=\"cardlink_footer\"><\/div><\/div>\n","protected":false},"excerpt":{"rendered":"CSV\u30d5\u30a1\u30a4\u30eb\u304b\u3089Excel\u30d5\u30a1\u30a4\u30eb\u306b\u5909\u63db\u3059\u308b\u51e6\u7406\u3092\u81ea\u52d5\u5316\u3057\u305f\u3044\u3001Excel\u304c\u4f7f\u7528\u3067\u304d\u308b\u74b0\u5883\u3067\u3042\u308c\u3070\u3001VBA\u3084VBScript\u3092\u4f7f\u7528\u3059\u308c\u3070\u6bd4\u8f03\u7684\u7c21\u5358\u306b\u51e6\u7406\u3067\u304d\u307e\u3059\u304c\u3001Excel\u304c\u7121\u3044\u74b0\u5883\u3067\u306f\u3069\u3046\u3059\u308c\u3070\u826f\u3044\u304b\uff1f \u4eca\u56de\u306f\u3001\u4e0b [&hellip;]","protected":false},"author":1,"featured_media":7127,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"[Excel\u3092\u4f7f\u308f\u305a\u306bCSV\u304b\u3089Excel\u30d5\u30a1\u30a4\u30eb\u306b\u5909\u63db\u3059\u308bPowerShell\u30b3\u30fc\u30c9]","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-11700","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-PowerShell.png","jetpack_shortlink":"https:\/\/wp.me\/p4UZZr-32I","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/11700","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=11700"}],"version-history":[{"count":1,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/11700\/revisions"}],"predecessor-version":[{"id":11703,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/11700\/revisions\/11703"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/media\/7127"}],"wp:attachment":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11700"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11700"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11700"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}