Skip Ribbon Commands
Skip to main content

Quick Launch

Todd Klindt's home page > Todd Klindt's Office 365 Admin Blog > Posts > Formatting ShareGate Log Files in Excel with PowerShell
June 12
Formatting ShareGate Log Files in Excel with PowerShell

Hi All,

Today, I want to share a handy PowerShell function I developed recently to enhance readability of ShareGate log files.

If you are using ShareGate for SharePoint migrations or management tasks, you might be familiar with the extensive Excel logs produced by ShareGate. While these logs are rich in details, they can sometimes be too rich in details. They often require some formatting for better readability or to highlight the necessary details. When doing a lot of migrations I found myself doing the same steps over and over again to these logs. Being lazy, I thought, “Someone should automate this!”. I sat down with my buddy PowerShell and this is what we came up with.

This function, Format-ShareGateLogFile, tackles this by opening a ShareGate log file in Excel format and applying a few changes. It does this by using Doug Finke’s excellent ImportExcel PowerShell Module. It adds a table to the first worksheet, formats the first column as "Date-Time", calculates the duration of the log file, and formats the duration as "[h]:mm:ss" in the last row. Finally, it saves the changes and closes the Excel file.

To use this function, you’ll have to download Logfiles.psm1 from my Github Repo. Then use Import-Module to import it into your PowerShell session.

After that’s done you can run Format-ShareGateLogFile. You will need to provide the path to the Excel file to format as an argument to the Path parameter, which is mandatory. For instance,

PS C:\> Format-ShareGateLogFile -Path "C:\path\to\ShareGateLogFile.xlsx"

This will format the Excel file located at "C:\path\to\ShareGateLogFile.xlsx" for readability.

The function also accepts two optional switches: Open and HideColumns. If you use the Open switch, the function will open the formatted Excel file automatically after it has finished formatting. The HideColumns switch will hide specified columns (E-U, W-AR, AT-BA) in the Excel file. For instance,


PS C:\> Format-ShareGateLogFile -Path "C:\path\to\ShareGateLogFile.xlsx" -HideColumns -Open

This will format the Excel file, hide the specified columns, and open the Excel file automatically after it has been formatted.

One neat feature of the function is that it can accept pipeline input for the `Path` parameter. This means you can pipe in a series of file paths to the function and it will format each file in turn. For instance,


PS C:\> Get-ChildItem -Path "C:\path\to\folder" -Filter "*.xlsx" | Format-ShareGateLogFile -HideColumns -Open

This will get all the Excel (.xlsx) files in the specified folder, and for each one, it will be formatted for readability, with specified columns hidden, and the Excel file opened automatically after it has been formatted.

This function has saved me heaps of time while working with ShareGate log files, and I hope it does the same for you. Happy scripting!

tk

ShortURL: https://www.toddklindt.com/PoshFormatSharegateLogs

Comments

Aiden

In fact My partner and i examine that last night yet I needed several feelings regarding it and after this I desired to learn that once more due to the fact it is extremely well written. สมัครดีใจ https://xn--82cxca4ej0dc7eb9iubxd.com/
 on 8/21/2023 6:47 AM

Angel17

Thanks for sharing this wonderful blog. Keep posting.  www.caryfencecompany.com/aluminum-fence
 on 8/26/2023 2:53 PM

Re: Formatting ShareGate Log Files in Excel with PowerShell

Appraisal assert who that is the an ideal put up from a amazing someone, so i am pleased to check out this unique.Appraisal assert who that is the an ideal put up from a amazing someone, so i am pleased to check out this unique.
 on 9/5/2023 7:08 AM

Re: Formatting ShareGate Log Files in Excel with PowerShell

Appraisal assert who that is the an ideal put up from a amazing someone, so i am pleased to check out this unique.Business News https://www.solarisnews.com/
 on 9/5/2023 7:09 AM

Aiden

This really is therefore stunning as well as innovative. I simply adore the actual colours as well as whomever will get this within the postal mail is going to be grinning. broken planet hoodie https://brokenplanetmarkets.com/hoodie/
 on 9/6/2023 7:28 AM

retro12

I really love reading your blog. It is very well-written and easy to understand. Thanks a lot! If you have more time, please visit: https://retrobowl-unblocked.io
 on 9/12/2023 11:44 PM

Aiden

Stick to the fantastic job, That i look over couple articles or blog posts on this subject web-site together with It is my opinion that online webpage is certainly legitimate appealing and features have communities for superb material. Youth Fitness Trainers Winter Park https://www.digitaljournal.com/pr/news/getnews/orlando-gym-launches-innovative-youth-personal-training-program-teaching-kids-and-teens-to-master-their-fitness-journey-
 on 9/13/2023 3:57 AM

Re: Formatting ShareGate Log Files in Excel with PowerShell

Brilliant text. A posting is affecting loads of imperative complications one's world. Most people can't be uninvolved so that you can all these complications. The following posting supplies plans plus basics. Pretty enlightening plus simple.spicyfood https://spicyfood.pro/ 
 on 9/17/2023 3:26 AM

XDGDRFEH

Superb publish, proceeded to go forward as well as saved your website. We can’t wait around to see much more through a person. <a href="https://taskky.online">taskky.online</a>
 on 9/19/2023 2:19 AM

Add Comment

Items on this list require content approval. Your submission will not appear in public views until approved by someone with proper rights. More information on content approval.

Title


Body *


Today's date *

Select a date from the calendar.
Please enter today's date so I know you are a real person

Twitter


Want a message when I reply to your comment? Put your Twitter handle here.

Attachments

 

 SysKit