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!
Karsten
September 4, 2024, 12:24pm
2
Hey @raphaelRosin ,
Unfortunately this is not supported at the moment.
Maybe we’ll have an early Christmas gift.
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
Hey @raphaelRosin ,
Eggplant 23.4.3 includes a lot of new excel commands. Eggplant Functional 23 Release Notes | EPF Docs and Excel File Interaction | EPF Docs
put newWorksheet(myWorkbook, “Flowers”) into flowerSheet
set myNewSheet to workbook’s newWorksheet(name:”Summary”, sequenceNumber:2, copyFrom: worksheet(1) of workbook)
set anotherSheet to newWorksheet(workbook:myWorkbook, name:“CustomerList”)
You can now for example. create a new worksheet ,copy an existing one, rename them, set and get colors and many more.
Cheers,
Karsten