{"id":4531,"date":"2019-08-19T14:35:48","date_gmt":"2019-08-19T14:35:48","guid":{"rendered":"http:\/\/officetuts.net\/excel\/?p=4531"},"modified":"2024-03-26T13:07:49","modified_gmt":"2024-03-26T13:07:49","slug":"excel-powershell","status":"publish","type":"post","link":"https:\/\/officetuts.net\/excel\/examples\/excel-powershell\/","title":{"rendered":"Excel Powershell"},"content":{"rendered":"\n

The Powershell Excel module is a way you can interact with\nExcel files. There is more than one Excel module you can choose from. The great\nthing about this approach is that you don\u2019t need to install Excel on your\nmachine in order to generate and manipulate Excel files.<\/p>\n\n\n\n

Alternative methods to Excel PowerShell modules<\/h2>\n\n\n\n

Before PowerShell, there have been a few ways to manipulate\nExcel files.<\/p>\n\n\n\n

Excel installation on the local machine<\/h3>\n\n\n\n

The simplest and most straightforward way to work with Excel\nfiles. There are at least two disadvantages of using this method. The first one\nis that you need to have an additional license. The second one it\u2019s not the\nfastest method to work with a huge number of files.<\/p>\n\n\n\n

Create a CSV file<\/h3>\n\n\n\n

Another way to work with files is to create a Comma\nSeparated File. The problem is that you don\u2019t have control when it comes to\nformatting or can create special objects like charts<\/a> or pivot tables. As the\nname suggests the element of the files are just separated by comma (or\ndifferent type of delimiter).<\/p>\n\n\n\n

There is also another problem with this approach. Sometimes,\nyou just have to work with Excel files, because this is the requirement of your\ncompany.<\/p>\n\n\n\n

Com objects<\/a><\/h3>\n\n\n\n

Another way to operate on Excel files is to remotely\ncontrol. You can do it with the help of the COM interface. You can create\nworkbook and worksheets<\/a> and insert data into appropriate cells.<\/p>\n\n\n\n

Here\u2019s a code that creates Excel and then adds a workbook.<\/p>\n\n\n\n

$xl = New-Object -ComObject Excel.Application\n$xl.Visible = $true\n$xl.Workbooks.Add()<\/code><\/pre>\n\n\n\n

ODBC connection<\/h3>\n\n\n\n

In this case, you use a .NET Open Database Connectivity.\nAfter setting up you can work in a similar way as you work with the COM\ninterfaces.<\/p>\n\n\n\n

Finding modules<\/h2>\n\n\n\n

In order to find PowerShell modules, you can visit the PowerShell repository<\/a>.<\/p>\n\n\n\n

After you click a link to a module, there, you will see an installation command.<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

On the left, you can see how many times the module was downloaded, and at the bottom, you can see how often the module is updated.<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

Installing a module<\/h2>\n\n\n\n

Installing a module is pretty straightforward. First, you\nhave to open the PowerShell window.<\/p>\n\n\n\n

In order to do it, navigate to search icon on a windows toolbar.<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

Type \u201cPowerShell\u201d. Right-click the icon and select Run as administrator<\/strong>. You can install modules only if you are an admin.<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

Inside the window, paste the command from installation\noptions by clicking the right mouse button. Press Enter<\/strong> to start the installation.<\/p>\n\n\n\n

When you installing a module, you probably will get a\nmessage about the untrusted repository. Press Y<\/strong>. The PowerShell Gallery is uncurated, so people can upload harmful\nscripts. Be sure that you download save scripts.  After a few seconds of installation, you will\nget back to the console.<\/p>\n","protected":false},"excerpt":{"rendered":"

The Powershell Excel module is a way you can interact with Excel files. There is more than one Excel module you can choose…<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[190],"yoast_head":"\nExcel Powershell<\/title>\n<meta name=\"description\" content=\"Learn how you can interact with Excel files without installing Excel on your machine using Powershell Excel module. Alternative methods also discussed.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/officetuts.net\/excel\/examples\/excel-powershell\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Excel Powershell\" \/>\n<meta property=\"og:description\" content=\"Learn how you can interact with Excel files without installing Excel on your machine using Powershell Excel module. Alternative methods also discussed.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/officetuts.net\/excel\/examples\/excel-powershell\/\" \/>\n<meta property=\"article:published_time\" content=\"2019-08-19T14:35:48+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-26T13:07:49+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2019\/08\/import-excel-module.png\" \/>\n<meta name=\"author\" content=\"Tomasz Decker\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Tomasz Decker\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/officetuts.net\/excel\/examples\/excel-powershell\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/officetuts.net\/excel\/examples\/excel-powershell\/\"},\"author\":{\"name\":\"Tomasz Decker\",\"@id\":\"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42\"},\"headline\":\"Excel Powershell\",\"datePublished\":\"2019-08-19T14:35:48+00:00\",\"dateModified\":\"2024-03-26T13:07:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/officetuts.net\/excel\/examples\/excel-powershell\/\"},\"wordCount\":463,\"publisher\":{\"@id\":\"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42\"},\"image\":{\"@id\":\"https:\/\/officetuts.net\/excel\/examples\/excel-powershell\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2019\/08\/import-excel-module.png\",\"keywords\":[\"pinterest\"],\"articleSection\":[\"examples\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/officetuts.net\/excel\/examples\/excel-powershell\/\",\"url\":\"https:\/\/officetuts.net\/excel\/examples\/excel-powershell\/\",\"name\":\"Excel Powershell\",\"isPartOf\":{\"@id\":\"https:\/\/officetuts.net\/excel\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/officetuts.net\/excel\/examples\/excel-powershell\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/officetuts.net\/excel\/examples\/excel-powershell\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2019\/08\/import-excel-module.png\",\"datePublished\":\"2019-08-19T14:35:48+00:00\",\"dateModified\":\"2024-03-26T13:07:49+00:00\",\"description\":\"Learn how you can interact with Excel files without installing Excel on your machine using Powershell Excel module. Alternative methods also discussed.\",\"breadcrumb\":{\"@id\":\"https:\/\/officetuts.net\/excel\/examples\/excel-powershell\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/officetuts.net\/excel\/examples\/excel-powershell\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/officetuts.net\/excel\/examples\/excel-powershell\/#primaryimage\",\"url\":\"https:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2019\/08\/import-excel-module.png\",\"contentUrl\":\"https:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2019\/08\/import-excel-module.png\",\"width\":740,\"height\":331},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/officetuts.net\/excel\/examples\/excel-powershell\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/officetuts.net\/excel\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Excel Powershell\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/officetuts.net\/excel\/#website\",\"url\":\"https:\/\/officetuts.net\/excel\/\",\"name\":\"\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/officetuts.net\/excel\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42\",\"name\":\"Tomasz Decker\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/officetuts.net\/excel\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/18cbe22837193574870ae40ba56bf712?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/18cbe22837193574870ae40ba56bf712?s=96&d=mm&r=g\",\"caption\":\"Tomasz Decker\"},\"logo\":{\"@id\":\"https:\/\/officetuts.net\/excel\/#\/schema\/person\/image\/\"},\"description\":\"Spreadsheet and Python enthusiast.\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Excel Powershell","description":"Learn how you can interact with Excel files without installing Excel on your machine using Powershell Excel module. Alternative methods also discussed.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/officetuts.net\/excel\/examples\/excel-powershell\/","og_locale":"en_US","og_type":"article","og_title":"Excel Powershell","og_description":"Learn how you can interact with Excel files without installing Excel on your machine using Powershell Excel module. Alternative methods also discussed.","og_url":"https:\/\/officetuts.net\/excel\/examples\/excel-powershell\/","article_published_time":"2019-08-19T14:35:48+00:00","article_modified_time":"2024-03-26T13:07:49+00:00","og_image":[{"url":"https:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2019\/08\/import-excel-module.png"}],"author":"Tomasz Decker","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Tomasz Decker","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/officetuts.net\/excel\/examples\/excel-powershell\/#article","isPartOf":{"@id":"https:\/\/officetuts.net\/excel\/examples\/excel-powershell\/"},"author":{"name":"Tomasz Decker","@id":"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42"},"headline":"Excel Powershell","datePublished":"2019-08-19T14:35:48+00:00","dateModified":"2024-03-26T13:07:49+00:00","mainEntityOfPage":{"@id":"https:\/\/officetuts.net\/excel\/examples\/excel-powershell\/"},"wordCount":463,"publisher":{"@id":"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42"},"image":{"@id":"https:\/\/officetuts.net\/excel\/examples\/excel-powershell\/#primaryimage"},"thumbnailUrl":"https:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2019\/08\/import-excel-module.png","keywords":["pinterest"],"articleSection":["examples"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/officetuts.net\/excel\/examples\/excel-powershell\/","url":"https:\/\/officetuts.net\/excel\/examples\/excel-powershell\/","name":"Excel Powershell","isPartOf":{"@id":"https:\/\/officetuts.net\/excel\/#website"},"primaryImageOfPage":{"@id":"https:\/\/officetuts.net\/excel\/examples\/excel-powershell\/#primaryimage"},"image":{"@id":"https:\/\/officetuts.net\/excel\/examples\/excel-powershell\/#primaryimage"},"thumbnailUrl":"https:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2019\/08\/import-excel-module.png","datePublished":"2019-08-19T14:35:48+00:00","dateModified":"2024-03-26T13:07:49+00:00","description":"Learn how you can interact with Excel files without installing Excel on your machine using Powershell Excel module. Alternative methods also discussed.","breadcrumb":{"@id":"https:\/\/officetuts.net\/excel\/examples\/excel-powershell\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/officetuts.net\/excel\/examples\/excel-powershell\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/officetuts.net\/excel\/examples\/excel-powershell\/#primaryimage","url":"https:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2019\/08\/import-excel-module.png","contentUrl":"https:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2019\/08\/import-excel-module.png","width":740,"height":331},{"@type":"BreadcrumbList","@id":"https:\/\/officetuts.net\/excel\/examples\/excel-powershell\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/officetuts.net\/excel\/"},{"@type":"ListItem","position":2,"name":"Excel Powershell"}]},{"@type":"WebSite","@id":"https:\/\/officetuts.net\/excel\/#website","url":"https:\/\/officetuts.net\/excel\/","name":"","description":"","publisher":{"@id":"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/officetuts.net\/excel\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42","name":"Tomasz Decker","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/officetuts.net\/excel\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/18cbe22837193574870ae40ba56bf712?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/18cbe22837193574870ae40ba56bf712?s=96&d=mm&r=g","caption":"Tomasz Decker"},"logo":{"@id":"https:\/\/officetuts.net\/excel\/#\/schema\/person\/image\/"},"description":"Spreadsheet and Python enthusiast."}]}},"_links":{"self":[{"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/posts\/4531"}],"collection":[{"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/comments?post=4531"}],"version-history":[{"count":3,"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/posts\/4531\/revisions"}],"predecessor-version":[{"id":7912,"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/posts\/4531\/revisions\/7912"}],"wp:attachment":[{"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/media?parent=4531"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/categories?post=4531"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/tags?post=4531"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}