How to set separate ranges on excel spreadsheet?

I want to create multiple charts on excel spreadsheet by powershell.
But I’m struggling to create ranges that are separate each other.

In case the series and data are locate side by side, it is able to make ranges as follows.
$dataRange = $ws.range(“E1:S14”)

However, when Legend and Data table are separate, I’m unable to set regions.
I’ve tried this format, but it returns an error.
$range = $ws.range(“E1:E14”,“H1:S14”)

Attached image is created by manual operation with use of Ctrl key.
I’d like to create this separate region with Powershell.
Please advise.

Machikado,

Welcome to the forum. :wave:t3:

Without having experiences with working with Excel … if I search for “Powershell Excel range multiple selection” one of the first hits is this:

It looks promissing to me. :+1:t3:

If you have to work with Excel sheets more than once you may take a look at the great module from Doug Finke

It could make you life much easier. :wink: :love_you_gesture:t3:

Thank you so much Olaf.
This was exactly i was looking for.
I could set up two different regions.
I was using the import-excel module, but the link you provided was really helpful.

I’m glad it helped. :+1:t3: :slightly_smiling_face: