How to get excel data from a single cell?


hi, i'm looking take group of 31 excel workbooks, loop through them, value same field (m7), of general format, , sum total of workbooks.

what i'm stuck on how data excel.  bit of web surfing far, have:

$workbook = $excel.workbooks.open("c:\path\to\file\1_3_14.xlsx")  $workbook.sheets.item(1).activate()  $workbooktotal=$workbook.worksheets.item(1).range("m7").value  $workbooktotal

when run this, don't value, following, not number.  if change field format general number, same:

$workbooktotal  (i have tired $workbooktotal.value, , same)

issettable          : true
isgettable          : true
overloaddefinitions : {variant value (variant)}
typenameofvalue     : system.object
membertype          : parameterizedproperty
value               : variant value (variant) {get} {set}
name                : value
isinstance          : true

can point me in right direction or tell me better way?

always, appreciated.



thanks,
kevin

i think close, understand after value in particular cell.

try this:

$workbook = $excel.workbooks.open("c:\path\to\file\1_3_14.xlsx") $workbook.sheets.item(1).activate() $workbooktotal=$workbook.worksheets.item(1) $value = $workbooktotal.cells.item(13, 7) $value.text #this should give value in cell

hope helps


knowledge power{shell}. http://dexterposh.blogspot.com/




Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

DCOM received error "2147746132" from...

DFSR RPC replication errors 5014 1726 with large files over VPN

ADFS 3.0 Event ID 4625 | An Error occurred During Logon | Status: 0xC000035B