Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty worksheets in Excel export #3

Closed
rraschke opened this issue Jun 13, 2018 · 3 comments
Closed

Empty worksheets in Excel export #3

rraschke opened this issue Jun 13, 2018 · 3 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@rraschke
Copy link

Hi @PrzemyslawKlys ,

great project! Just one issue occured to us during importing the Excel export into MSSQL. There are empty Excel worksheets for for reporting regions, where no events happened. Changing the following code in "PSWinReportingHelper.ps1"

function Export-ReportToXLSX ($Report, $ReportOptions, $ReportFilePath, $ReportName, $ReportTable) { if ($Report -eq $true) { $ReportTable | Export-Excel -Path $ReportFilePath -WorkSheetname $ReportName -AutoSize -FreezeTopRow -AutoFilter return } else { return } }

to

function Export-ReportToXLSX ($Report, $ReportOptions, $ReportFilePath, $ReportName, $ReportTable) { if (($Report -eq $true) -and ($($ReportTable | Measure-Object).Count -gt 0)) { $ReportTable | Export-Excel -Path $ReportFilePath -WorkSheetname $ReportName -AutoSize -FreezeTopRow -AutoFilter return } else { return } }

got rid of the empty worksheets. Maybe this can be added to the next version?

Kind Regards
Robert

@PrzemyslawKlys PrzemyslawKlys self-assigned this Jun 13, 2018
@PrzemyslawKlys PrzemyslawKlys added the good first issue Good for newcomers label Jun 13, 2018
@PrzemyslawKlys
Copy link
Member

Makes sense. Will incorporate. Although in some cases it may be useful to know there were no events. Maybe a switch in config. Or maybe direct write to sql should be added :-) You know you can always do pull requests...

@rraschke
Copy link
Author

Sorry, I am quite new to Github and was just looking for an option to comment on the code.
Direct SQL writing would be great, by the way.

@PrzemyslawKlys
Copy link
Member

Implemented, published gallery and github sources updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants