mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-06 00:23:20 +00:00
Standardise file cleanup
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
|
||||
|
||||
$xlfile = "$env:TEMP\visitors.xlsx"
|
||||
Remove-Item $xlfile -ErrorAction SilentlyContinue
|
||||
#Get rid of pre-exisiting sheet
|
||||
$xlSourcefile = "$env:TEMP\ImportExcelExample.xlsx"
|
||||
Write-Verbose -Verbose -Message "Save location: $xlSourcefile"
|
||||
Remove-Item $xlSourcefile -ErrorAction Ignore
|
||||
|
||||
$data = ConvertFrom-Csv @"
|
||||
Week, TotalVisitors
|
||||
@@ -25,5 +27,5 @@ $cd = New-ExcelChartDefinition `
|
||||
-NoLegend `
|
||||
-ChartTrendLine Linear
|
||||
|
||||
$data | Export-Excel $xlfile -Show -AutoNameRange -AutoSize -TableName Visitors -ExcelChartDefinition $cd
|
||||
$data | Export-Excel $xlSourcefile -Show -AutoNameRange -AutoSize -TableName Visitors -ExcelChartDefinition $cd
|
||||
|
||||
|
||||
Reference in New Issue
Block a user