If Query Mode is disabled for the spreadsheet, you cannot write SQL statements to query the spreadsheet. Instead, you need to specify the query details by filling in the data extraction parameters. This also means that, when query mode is disabled, you cannot use the data service to insert, update, or modify data in the spreadsheet. This data service can only be used to get data that is already stored in the spreadsheet. Follow the steps given below: Click Add New Query and add the following details: Query ID | GetProducts |
---|
Datasource Type | EXCEL |
---|
Workbook Name | Sheet1
You want the query to get the data from Sheet1 in the excel spreadsheet. |
---|
Start reading from | 2
You enter 2 because the 1st row of the spreadsheet is the header. The data is available from row 2 onwards. |
---|
Rows to read | 5
Five rows of data will be fetched by the query. |
---|
Headers available | true |
---|
Header row | 1
You enter 1 because the 1st row of the spreadsheet includes the header. |
---|
- Define Output Mapping:
Now, let's specify how the data fetched from the datasource should be displayed in the output. The Excel datasource we are using contains three columns: ID, Model, and Classification. We will create an output mapping for each of these columns. Start by giving the following information: Output type | Select XML. You can select XML, JSON, or RDF. This specifies the format in which the query results should be presented. |
---|
Grouped by element | Enter Products. This is the XML element that groups the query result. |
---|
Row Name | Enter Product. This is the XML element that should group each individual result. |
---|
Click Add New Output Mapping to start creating the output mapping. Listed below are the output mappings that should be created. Fill in the details and click Add to add each output mapping. Mapping Type | Element Name | Datasource Type | Datasource Column Name | Parameter Type | Schema Type |
---|
Element | ID | Column | ID | SCALAR | string | Element | Model | Column | Model | SCALAR | string | Element | Classification | Column | Classification | SCALAR | string |
- Once you have created all of the above mappings, click Main Configuration to return to the Query screen.
- Save the query.
|