我必须从存储在我的文档库中的Excel文档中获取数据,并在列表中显示数据。我的脚本运行正常,但在$workbook
它会提示我传递凭据。
这个问题可以解决吗?
$web = Get-SPWeb -Identity 'http://.....'
$list = $web.Lists['XL List']
$XLSDoc ='http://...'
$SheetName = 'Overall Project Health'
$Excel = New-Object -ComObject 'Excel.Application'
$Workbook = $Excel.workbooks.open($XLSDoc)....
$Sheet = $Workbook.Worksheets.Item($SheetName)
答案 0 :(得分:0)
试试这个:
$Workbook = $Excel.workbooks.open($XLSDoc, $false, $true)
参考:
http://msdn.microsoft.com/en-us/library/aa195811(office.11).aspx