Question

If an indexer in C# is expressed as: index[1, 1]. How would you express this with powershell?

To be more specific, I'm trying to use EPPlus with Powershell to generate excel documents. However I'm having a problem select cells using its cell index property.

I posted a thread on Epplus' discussion forum but I'm not entirely sure where to go from there.

Was it helpful?

Solution

WorkBook.Cells is an ExcelRange object that provides access to cell via Indexers.

Indexers are syntactic sugar that don't translate directly to PowerShell, use this instead:

$WorkSheet.Cells.Item(1,1).Value = "Cell 1"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top