Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

Commit

Permalink
Merge pull request #67 from cisagov/excelcomobjectissue
Browse files Browse the repository at this point in the history
Added try-catch loop for Excel issue
  • Loading branch information
genericdevname authored Feb 11, 2021
2 parents d5081aa + 0a79610 commit a1aac33
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Sparrow.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,13 @@ Function New-ExcelFromCsv() {
$Workbook.Sheets[$ToDelete].Delete()
}
$Workbook.Activate()
$Workbook.SaveAs((Join-Path $ExportDir 'Summary_Export.xlsx'))
Try{
$Workbook.SaveAs((Join-Path $ExportDir 'Summary_Export.xlsx'))
} Catch{
Write-Warning "An error has occurred. No combined .xlsx will be produced."
Write-Warning "The csvs remain in the default export directory."
}

$Excel.Quit()
}

Expand Down

0 comments on commit a1aac33

Please sign in to comment.