mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-10 13:23:29 +00:00
Standardise file cleanup
This commit is contained in:
@@ -1,7 +1,9 @@
|
|||||||
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
|
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
|
||||||
|
|
||||||
$xlfile = "$env:TEMP\visitors.xlsx"
|
#Get rid of pre-exisiting sheet
|
||||||
Remove-Item $xlfile -ErrorAction SilentlyContinue
|
$xlSourcefile = "$env:TEMP\ImportExcelExample.xlsx"
|
||||||
|
Write-Verbose -Verbose -Message "Save location: $xlSourcefile"
|
||||||
|
Remove-Item $xlSourcefile -ErrorAction Ignore
|
||||||
|
|
||||||
$data = ConvertFrom-Csv @"
|
$data = ConvertFrom-Csv @"
|
||||||
Week, TotalVisitors
|
Week, TotalVisitors
|
||||||
@@ -25,5 +27,5 @@ $cd = New-ExcelChartDefinition `
|
|||||||
-NoLegend `
|
-NoLegend `
|
||||||
-ChartTrendLine Linear
|
-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