VMware Cloud Community
Chiel
Enthusiast
Enthusiast

Powershell with Excel

Hi all,

I've received some great help here not to long ago so i thought i would turn to the community once more

for a for me rather difficult solution.

Ok the situation.

We keep an excel sheet up to date every week. It looks something like this.

ClusterName

Number of Host Total CPU Resource Total Memory Number of VM's Total CPU's Virtualisation degree

Week 1 7 39Ghz 48 GB 53 8 7.57 (53 / 7)

Week 2 7 39Ghz 48 GB 57 8 8.14 (57 /7)

I've also added an excel example.

Now i have a script that comes with all these numbers. What i want is that when i run the script, it adds the next line in the already exisiting excel sheet with all the information.

So it somehow must read at which cell the last entry was and then fill in the next line. I can number the weeks by hand of course, or if this can be automated

as well that would be great. Or something that when you call the script you have to enter the week number might be easier?

Anyone know how i should approach this?

Thanks in advance for any help you guys can give.

Kind regards,

Michiel

Reply
0 Kudos
3 Replies
a2alpha
Expert
Expert

I think I would approach this by using the script to Export-CSV and then use a custom macro in your excel sheet which puts the information in. You could have the macro autorun when you open the sheet or have a custom button for it.

For the out-file command you can use an -append switch, not sure if this exists in the export-csv command.

This might be a starting point for you, I'm sure someone else will have a better way though! Smiley Happy

Dan

Reply
0 Kudos
a2alpha
Expert
Expert

You might find this post useful:

http://communities.vmware.com/thread/151078

Reply
0 Kudos
Zsoldier
Expert
Expert

This is a script I found a while back that I pulled to start to figure out how to output to Excel. It's pretty good and might give you some ideas as to what you need to do.

K. Chris Nakagaki (Zsoldier)

Chris Nakagaki (中垣浩一)
Blog: https://tech.zsoldier.com
Twitter: @zsoldier
Reply
0 Kudos