Last active
January 4, 2016 02:49
-
-
Save altrive/8557372 to your computer and use it in GitHub Desktop.
Sample code to output excel file using ClosedXML
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Use-NuGetPackage -PackageId ClosedXML -Verbose | |
| #Set .Net current path | |
| [IO.Directory]::SetCurrentDirectory((Get-Location).Path) | |
| #Output Excel file to current directory | |
| $workbook = New-Object ClosedXML.Excel.XLWorkbook | |
| $worksheet = $workbook.Worksheets.Add("Sample Sheet"); | |
| $worksheet.Cell("A1").Value = "Hello World!"; | |
| $workbook.SaveAs("HelloWorld.xlsx"); | |
| $worksheet.Dispose() | |
| #Open Excel File | |
| explorer "HelloWorld.xlsx" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment