Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I need to read cells values from a worksheet and i am referencing the following piece of code, however i don't get .Items() method.

Code Referred:

$objWorksheet.Cells.Item(2,1).Text

Also is there any other way we can read the cell values? Any suggestions/help would be highly appreciated.

Regards, Ketan

share|improve this question
add comment

1 Answer 1

I believe it would be:

$VaribleObject = $objWorksheet.Cells.Item(2, 1).Value()

I hope this helps ;)

Reference:
http://blogs.msdn.com/b/sriram_reddy1/archive/2012/07/16/excel-with-powershell.aspx

share|improve this answer
    
Done using same way..still giving error $excelObj = New-Object -ComObject "Excel.Application" $wrkBook = $excelObj.Workbooks.Open("FILE_PATH") $wrkShtGroup = $wrkBook.Worksheets.Item(4) $wrkShtGroup.Cells.Items(2,2).Value() –  Ketan03 Aug 17 '12 at 11:43
    
Hi that really strange! I dont really use poweshell meself but I fond this that should help! goto page 378. It goes into detail far more than I could as I dont know what code you might have thats effecting the result! hope it helps –  ali Sharepoint Aug 17 '12 at 12:59
    
the code iv done is correct, make sure your worksheet is correct? so you have 4 sheets within the workbook and you want to access the fourth? also your accessing row 2, 1 would be the header. the second val is 2 which would be column 2! blogs.msdn.com/b/sriram_reddy1/archive/2012/07/16/… –  ali Sharepoint May 12 at 7:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.