Erik Hoffmann
posted this on November 03, 2009 21:14
Here is the way to get data from an Excel spreadsheet. Add a datasource in Administration - Configuration - Data Source E.g. Name: Excel Connection: Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\project\training 19-10-2005\metricvalues_200510.xls;Extended Properties="Excel 8.0;HDR=Yes;IMEX=1" Press "Test Datasource" Press "Save" The Data Source part of the connection refers to the Excel file Define a metric in Reporter - Metric Then Edit the metric and click "Datasource" Select Source Database "Excel" Enter a query in Source Query, e.g. select count(*) from exceltable1 Press "Test Query" Press "Save" Other example queries: select count(*) from [sheet1$a1:b4] (If you do not specify named ranges) select value from exceltable2 where metric='excel4' The Attached Excel sheet contains two named regions, exceltable1 and exceltable2 In Excel: Insert - Name - Define... A common error when testing the query : It is already opened exclusively by another user, or you need permission to view its data Solution: close the excel sheet Both IIS and the collector should have access to the Excel file More information on "How To Use ADO with Excel Data from Visual Basic or VBA"