Hello!
You can use external data sources for that.
In short: you need to add an external data source, set names and names in data source for table and columns. External data source name for table will be the name of the MS Excel sheet and a $ sign after that. Names of columns are values in first row of the sheet.
After that by setting the external data source connection string you can set the path to file and after that execute queries to that external data source.
Code |
---|
ConnectionParameters = New ExternalDataSourceConnectionParameters;
ConnectionParameters.ConnectionString = "Driver={Microsoft Excel Driver (*.xls)};"
+ "DBQ=C:\import\test.xls; DriverID=790";
ExternalDataSources.ImportExcel.SetCommonConnectionParameters(ConnectionParameters);
ExternalDataSources.ImportExcel.Connect();
Query = New Query();
Query.Text = "SELECT
| Test.Name AS Name,
| Test.Value AS Value
|FROM
| ExternalDataSource.ImportExcel.Table.Test AS Test";
ValueToFormAttribute(Query.Execute().Unload(), "ValueTable"); |
See the attached files for example.