]> apps.delaporte.us Git - dotfiles.git/commitdiff
Script to extract markdown from a teams project Excel export.
authorEdward Delaporte <delaport@illinois.edu>
Wed, 13 Jan 2021 21:26:55 +0000 (15:26 -0600)
committerEdward Delaporte <delaport@illinois.edu>
Wed, 13 Jan 2021 21:26:55 +0000 (15:26 -0600)
Toybox/Teams2Markdown.ps1 [new file with mode: 0644]

diff --git a/Toybox/Teams2Markdown.ps1 b/Toybox/Teams2Markdown.ps1
new file mode 100644 (file)
index 0000000..3d3ebc7
--- /dev/null
@@ -0,0 +1,48 @@
+<#
+.SYNOPSIS
+    Converts a Microsoft Teams Project Board Excel export into Markdown.
+
+.PARAMETER Path
+    The path to an Excel file exported from a Microsoft Teams project.
+
+.PARAMETER StartRow
+    The first row of data in the Teams project Excel export.
+    Defaults to 5.
+
+.EXAMPLE
+
+> ./Teams2Markdown.ps1 -Path C:\tmp\TeamsExport.xlsx | Out-File -Path c:\TeamsMarkdown.md
+
+.NOTES
+
+This script requires the Import-Excel module, available in PowerShell gallery.
+
+> Install-Module Import-Excel
+
+#>
+param(
+  [string]$Path,
+  [int]$StartRow = 5
+)
+
+$xlData = Import-Excel -Path $Path -StartRow $StartRow
+
+  # $xlData | Select-Object -First 2 | Format-List
+
+$xlData | Sort-Object { $_."Bucket" } | ForEach-Object {
+  if(!$_."Task Name" -eq "") {
+    ""
+    "## $($_."Task Name") - $($_."Bucket Name")"
+    ""
+
+    if(!$_."Description" -eq "") {
+      "$($_."Description")"
+    }
+
+    if(!$_."Checklist Items" -eq "") {
+      $_."Checklist Items".split(';') | ForEach-Object {
+        "+ $($_)"
+      }
+    }
+  }
+}
\ No newline at end of file