Vbscript / Ms Office / Read Data From Spreadsheet
Read an Excel spreadsheet column into an array.
Dim arrExcelData() strExcelFile = "C:\test.xls" Set objExcel = CreateObject("Excel.Application") Set objWorkbook = objExcel.Workbooks.Open(strExcelFile) objExcel.Visible = True i = 1 x = 0 Do Until objExcel.Cells(i, 1).Value = "" ReDim Preserve arrExcelData(x) arrExcelData(x) = objExcel.Cells(i, 1).Value i = i + 1 x = x + 1 Loop objExcel.Quit 'Example Usage For Each strItem in arrExcelData Wscript.Echo strItem Next
Please note that a disclaimer applies to any code on this page.
|