Advertisement
Naivalf

Excel Cell Reading

Jul 16th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $filepath = "C:/test.xlsm"
  2.  
  3. Write-Host "file : " $filepath
  4.  
  5. [System.Threading.Thread]::CurrentThread.CurrentCulture = [System.Globalization.CultureInfo] "en-US"
  6.  
  7. $Excel = New-Object -ComObject excel.application
  8. $Excel.visible = $false
  9.  
  10. $Workbook = $excel.Workbooks.open($filepath)
  11. $Worksheet = $Workbook.WorkSheets.item("Feuil1")
  12. $Worksheet.activate()
  13.  
  14. $cell=  $worksheet.Cells.Item(2,1).Value()
  15.  
  16. # End of program, we close Excel
  17. $workbook.Close()
  18. $excel.Quit()
  19.  
  20. write-host $cell
  21.  
  22. Read-Host
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement