Establishing a Connection
This section describes how to connect to Excel Services from your AnyPoint Studio project. You can use wizards or the XML editor in AnyPoint Studio to define connection properties in a global element. Global elements can be reused across other building blocks in your project.
Create a Connection in the Visual Editor
Complete the following steps to visually add the connector to your project and create a connection:
- Create a new Mule Project in Anypoint Studio.
- From the palette, drag the connector into your Mule flow.
- On the Message Flow canvas, double-click the connector icon to open the connector properties in the Properties pane.
- In the General section, click Add and define the Excel Services connection properties. Note that the user name and Password properties always appear here. The user name must be set as it is used as the key for the connection if connection pooling is enabled.
Create a Connection in the XML Editor
Set connection properties in the <cdata-excelservices:config> element in the root of the project's XML.
Note: The user name attribute must always be included here and serves as the key for the connection if connection pooling is enabled.
<cdata-excelservices:config name="CData_ExcelServices_Configuration" username="MyName" connectionProperty1="MyProperty" ... doc:name="CData ExcelServices: Configuration"/>
This section provides the details for connecting to SharePoint Online and SharePoint On Premises.
Connecting to a Workbook
Regardless of which edition of SharePoint you are using, set File to the Excel workbook. This path is relative to the following properties:
- Library: The Shared Documents library is used by default. You can use this property to specify another document library in your organization; for example, if you want to connect to OneDrive for Business, set this property to "Documents".
- Folder: You can use this property to specify a path to a subfolder in a library. The path is relative to the library name specified in Library.
Connecting to Spreadsheet Data as Tables
The connector detects the available tables based on the available objects in the underlying API.
The APIs surface different API objects; select the API based on the organization of your spreadsheets and your SharePoint version:
- OData: The OData API allows access to tables defined from Excel table objects (not ranges or spreadsheets), which you create by clicking Insert > Table in Excel. This is the default API. When connecting to the OData API, the connector may not return any tables if you do not have table objects defined in your workbook. Set UseRESTAPI to true to connect to spreadsheets or ranges as tables.
- REST: The REST API enables access to tables defined from Excel table objects, ranges, and spreadsheets. Requesting a large number of rows from ranges and spreadsheets is restricted by the REST API, and the connector limits the number of rows returned to 100 by default. The connector also defaults to detecting column names from the first row; set Header to disable this.
With DefineTables additionally set, you can define tables based on ranges, using the Excel range syntax. A range that is too large will be restricted by the API.
See Data Model for more information on how the connector detects tables and how to query them.
Connecting to SharePoint Online
Set SharePointEdition to "SharePoint Online" and set the User and Password for an Azure Active Directory account.
Set the Url to a site collection to query workbooks in all nested subsites. Set the Url to a site to query workbooks in that site only.
|Site||https://teams.contoso.com/teamA or https://teamA.contoso.com|
Connecting to SharePoint On Premises
Set SharePointEdition to "SharePoint OnPremise" and set the Url to your server's name or IP address. Additionally, set SharePointVersion and the authentication values.
To authenticate to SharePoint OnPremise, set AuthScheme to the authentication type and set User and Password, if necessary.
Note: When connecting to SharePoint On-Premises 2010, you must set UseRESTAPI to true.
- Windows (NTLM): This is the most common authentication type. As such, the connector is preconfigured to use NTLM as the default; simply set the Windows User and Password to connect.
- Kerberos and Kerberos Delegation: To authenticate with Kerberos, set AuthScheme to NEGOTIATE. If needed, provide the User and Password properties. To use Kerberos Delegation, set AuthScheme to KERBEROSDELEGATION. KerberosKDC, KerberosSPN, and KerberosRealm enable control over the components of Kerberos authentication.
- Forms: This allows authentication through a custom authentication method, instead of Active Directory. To use this authentication type, set AuthScheme to FORMS and set the User and Password.
Configure Connector Operations
The connector is an operation-based connector; its operations correspond to SQL statements and expose other functionality such as Schema Discovery. See Using the Connector (Mule 3.8+) for more information on executing SQL to Excel Services in Mule applications.