Excel and PowerShell

Hello guys,

I have a little issue on this Excel, I’m trying to make multiple reports (one domain by worksheet) but the first page should be stats on all the domains.

Here’s my code :

$workbook = $excelfile.Workbooks.Add() $worksheet = $excelfile.Worksheets.item(1) $page = 1 # First page ResumeExchange $domainlist $worksheet $excelfile $workbook .Worksheets.item($page).Name = "Exchange" $page++ # All domains to process foreach($domain in $Domainlist) { $Excelfile.WorkSheets.add() $worksheet = $ExcelFile.Worksheets.Item($page) $Excelfile.Worksheets.item($page).Name = $domain $worksheet = $ExcelFile.Worksheets.Item($page).activate() ResumeDomain $domain $worksheet $page++ } 

The issue is that POSH can’t invoke a method into a null expression when I call the $worksheet like this:

$worksheet.Cells.Item($ligne,$colonne)= $data

If you ever did some work with Excel, can you help me on that case ?

Thanks in advance

submitted by /u/McDoMaster
[link] [comments]

Leave a Reply