How to setup VBA macro with PowerShell?

In this last post of the series, I am going to mix Excel, PowerShell and VBA. If you weren’t using PowerShell to manage Excel files before, you might have used VBA (Visual Basic for Applications) to do so. Excel is a powerful tool and even this area can be improved a little bit with PowerShell.Continue reading “How to setup VBA macro with PowerShell?”

How to add pictures to Excel with PowerShell?

Spreadsheets’ main purpose is data: storing, manipulating and analyzing them. We can add some colours or charts to make the data more friendly, but sometimes we may want to add something else – like a logo or picture and all that can be achieved with PowerShell. Preparation Firstly, let’s prepare our environment to make sureContinue reading “How to add pictures to Excel with PowerShell?”

How to set Excel style with PowerShell?

Microsoft Excel helps to format any single cell in many ways. From setting background colours, through adding border styles to presenting date in different formats. In this post we will play with styles and formatting a little bit. Preparation Let’s prepare our environment now to make sure the file does not exist. As an illustration,Continue reading “How to set Excel style with PowerShell?”

How to import/export data between SQL Server and Excel using PowerShell?

ImportExcel is a powerful tool to manage MS Excel, however, the user is not limited to data stored in worksheets. We can import from and export to SQL Excel data using a combination of ImportExcel and dbatools modules. You can read how to start with dbatools in this blog series. Preparation Let’s prepare our environmentContinue reading “How to import/export data between SQL Server and Excel using PowerShell?”

How to protect Excel using PowerShell?

Last month we have been hiding things in Excel, so this week we are going to make sure they are protected as well. Excel offers multiple levels of password protection and its options: locking file with a password, i.e. without key phrase opening file is not possible protecting workbook’s structure lastly, protecting individual worksheets fromContinue reading “How to protect Excel using PowerShell?”

How to change Excel metadata using PowerShell?

So far we have been working on data or worksheets, but today we will look closer at some workbook-level properties and metadata. Workbook properties Open any Excel file and go to File > Info. You should see something like that on the right side: When you look at the bottom there is a link toContinue reading “How to change Excel metadata using PowerShell?”

How to move Excel worksheets using PowerShell?

Do you have a long list of the Excel sheets in one file? How do you find what you need quickly? Moving around spreadsheets and making coloured tabs might help you. Moving worksheets around When we want to place the worksheet in a different place it is simple as drag&drop or using the context menu.Continue reading “How to move Excel worksheets using PowerShell?”

How to validate Excel using PowerShell?

The Microsoft Excel spreadsheet is very flexible, users can put whatever they want and it will accept it – even if it does not make much sense. Data Validation in Excel Luckily there is a feature called Data Validation (under Data > Data Tools). The feature helps to control the values in the spreadsheet, soContinue reading “How to validate Excel using PowerShell?”

How to hide Excel using PowerShell?

MS Excel offers many different functionalities and one of them is making things to disappear like hiding worksheets or columns and rows, even cells. This week’s post is for your eyes only 😉 Preparation Let’s prepare our environment now to make sure the file does not exist. As an example, we will use a workbookContinue reading “How to hide Excel using PowerShell?”

How to make Excel hyperlinks using PowerShell?

Last week I have mentioned the new functions waiting to be included into the module. This week I would like to write about another set of functions: Add-ExcelHyperlink Get-ExcelHyperlink Remove-ExcelHyperlink Those are fresh too and were inspired by a query I have got from Garry Bargsley (blog|twitter) who needed adding hyperlinks to the existing cellsContinue reading “How to make Excel hyperlinks using PowerShell?”

Design a site like this with WordPress.com
Get started