How to create a new worksheet in Excel

Hello,
Is there a way to create/copy worksheets within an existing Excel workbook? I would like to dynamically add new Excel sheets during execution.

I have looked at this page but it does not have any info on creating new sheets, only accessing existing ones.

Thank you!

Hey @raphaelRosin,
Unfortunately this is not supported at the moment.
Maybe we’ll have an early Christmas gift. :wink:
We’ll keep you posted.

In the meantime:
What is your use case. Maybe we can find another solution to offer.

Cheers,
Karsten

Thanks Karstem - I thought that might be the case. I’ve written a PowerShell script instead - See below if anyone has the same question!

param (

[string]$ExcelPath,

[string]$NewSheetName

)

$importFile = $ExcelPath

$excel = New-Object -Com Excel.Application

$workbook = $excel.Workbooks.Open($ExcelPath)

$worksheet = $workbook.Sheets.Add()

$worksheet.Name = $NewSheetName

$workbook.save()

$workbook.close()

$excel.Quit()

Write-Output “Process Complete”

1 Like