# Export the output of a script into a new worksheet in an exsiting file in XL

**URL:** <https://forums.powershell.org/t/export-the-output-of-a-script-into-a-new-worksheet-in-an-exsiting-file-in-xl/20345>\
**Category:** PowerShell Help\
**Created:** [September 5, 2022, 11:11pm UTC](https://forums.powershell.org/t/export-the-output-of-a-script-into-a-new-worksheet-in-an-exsiting-file-in-xl/20345 "2022-09-05T23:11:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![boulbul](https://avatars.discourse-cdn.com/v4/letter/b/a183cd/32.png) [@boulbul](https://forums.powershell.org/u/boulbul)\
**Post date:** [September 5, 2022, 11:11pm UTC](https://forums.powershell.org/t/export-the-output-of-a-script-into-a-new-worksheet-in-an-exsiting-file-in-xl/20345/1 "2022-09-05T23:11:29Z")

</div>

Hi,

I would like to run a script several times. But each time I run it, I would like the output to be sent to an existing XL file but a new worksheet with a Title + Today’s date.

Here is my code:

```auto
$Result | Export-Excel -Path C:\temp\allVM.xls -WorksheetName 'Title'

```

Many thanks in advance.

Kind regards,

Boulbul

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [September 5, 2022, 11:12pm UTC](https://forums.powershell.org/t/export-the-output-of-a-script-into-a-new-worksheet-in-an-exsiting-file-in-xl/20345/2 "2022-09-05T23:12:59Z")

</div>

And what is your question?

You may watch this video where Doug explains a lot of stuff you can do with his module.

[![](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/2X/6/6a8e01b7b7bf1d7ebad8f63c436bb8a64cf467ce.jpeg "ImportExcel PowerShell + Excel = Better Together! with Doug Finke") ](https://www.youtube.com/watch?v=0bR-8b6OMTk)

---

<div class="post-metadata">

**Author:** ![boulbul](https://avatars.discourse-cdn.com/v4/letter/b/a183cd/32.png) [@boulbul](https://forums.powershell.org/u/boulbul)\
**Post date:** [September 5, 2022, 11:13pm UTC](https://forums.powershell.org/t/export-the-output-of-a-script-into-a-new-worksheet-in-an-exsiting-file-in-xl/20345/3 "2022-09-05T23:13:54Z")

</div>

Sorry Olaf,

My question is how to add a today’s date to the name of the worksheet please?

Thanks

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [September 5, 2022, 11:16pm UTC](https://forums.powershell.org/t/export-the-output-of-a-script-into-a-new-worksheet-in-an-exsiting-file-in-xl/20345/4 "2022-09-05T23:16:31Z")

</div>

> [@boulbul](#):
>
> how to add a today’s date to the name of the worksheet please?

If that’s all …

```auto
$Today = Get-Date -Format 'yyyy-MM-dd'
$Title = 'Title ' + $Today 
$Result | Export-Excel -Path C:\temp\allVM.xls -WorksheetName $Title 

```

---

<div class="post-metadata">

**Author:** ![boulbul](https://avatars.discourse-cdn.com/v4/letter/b/a183cd/32.png) [@boulbul](https://forums.powershell.org/u/boulbul)\
**Post date:** [September 5, 2022, 11:17pm UTC](https://forums.powershell.org/t/export-the-output-of-a-script-into-a-new-worksheet-in-an-exsiting-file-in-xl/20345/5 "2022-09-05T23:17:37Z")

</div>

Olaf,

You are a start…thank you…THANK YOU… and thank you again.

Have a nice evening.

Regards,

Boulbul

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:16pm UTC](https://forums.powershell.org/t/export-the-output-of-a-script-into-a-new-worksheet-in-an-exsiting-file-in-xl/20345/6 "2024-05-16T20:16:40Z")

</div>


