Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
123 lines (90 loc) · 2.32 KB

File metadata and controls

123 lines (90 loc) · 2.32 KB
Copy raw file
Download raw file
Outline
Edit and raw actions

Convert-CsvToXls

SYNOPSIS

Convert a .csv file to xlsx (despite the name)

Script file

Data Wrangling\Convert-CsvToXls.ps1

SYNTAX

Convert-CsvToXls [[-Path] <String>] [-DeleteSource] [-Delimiter <String>] [-Name <String>] [-Show]

DESCRIPTION

The implementation is a combination of two functions I found on StackOverflow and GitHub/Gist (see Links).

EXAMPLES

-------------------------- EXAMPLE 1 --------------------------

Convert-CsvToXls c:\test.csv

-------------------------- EXAMPLE 2 --------------------------

$csvFile | Convert-CsvToXls

PARAMETERS

-Path

Path of the CSV file to be converted (accepts pipeline input via dir). If no path is provided an open file dialog is opened to select the path.

Type: String
Parameter Sets: (All)
Aliases: FullName

Required: False
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False

-DeleteSource

Switch to indicate wheter the source CSV file will be deleted.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: 

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Delimiter

Delimiter used in the CSV. Defaults to system settings delimiter.

Type: String
Parameter Sets: (All)
Aliases: 

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Name

The name for the resulting excel worksheet. Defaults to the file base name.

Type: String
Parameter Sets: (All)
Aliases: 

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Show

Switch paramenter, if set the resulting Excel file will be opened.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: 

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

INPUTS

OUTPUTS

NOTES

RELATED LINKS

https://gist.github.com/XPlantefeve/75bde89c6967569d218f

https://stackoverflow.com/questions/17688468/how-to-export-a-csv-to-excel-using-powershell

Morty Proxy This is a proxified and sanitized view of the page, visit original site.