Application Programming Interface Guide > DSL API > Data Sources > Excel Data Sources
 
Excel Data Sources
This section describes the usage of DSL APIs for creating, altering or deleting a Excel data source.
Considerations
Listed below are some points to consider while working with Excel Data Sources:
During an alter operation, the properties that were previously set during a create will not be altered unless a new value or NULL is specified.
Examples
MS Excel (non-ODBC) Data Source Creation
//create excel datasource using DSL syntax
curl -d "[\"CREATE DATASOURCE /shared/examples/excelds
BASED ON ADAPTER 'Microsoft Excel (non-ODBC)'
CONNECT USING LOCAL_ROOT_PATH '/Users/Shared/excel'
FORMAT USING CHARACTER_SET 'utf-8'
SET ANNOTATION 'this is a excel datasource created using DSL api'\"]"
-u "admin:admin" -X POST "http://localhost:9400/rest/execute/v1/actions/dsl/invoke" -H "Content-Type:application/json"
//specify create ds using only native properties
curl -d "[\"CREATE DATASOURCE /shared/examples/excelds
BASED ON ADAPTER 'Microsoft Excel (non-ODBC)'
SET NATIVE PROPERTIES {\\\"root\\\":\\\"/Users/Shared/excel\\\",
\\\"filters\\\":\\\"*.xls\\\",
\\\"charset\\\":\\\"utf-8\\\"}
SET ANNOTATION 'this is a excel datasource created using DSL api'\"]"
-u "admin:admin" -X POST "http://localhost:9400/rest/execute/v1/actions/dsl/invoke" -H "Content-Type:application/json"
MS Excel (ODBC) only on windows
//create excel datasource DSL
curl -d "[\"CREATE DATASOURCE /shared/examples/excelds
BASED ON ADAPTER 'Microsoft Excel'
CONNECT USING DSN 'excelodbc'
FORMAT USING CHARACTER_SET 'utf-8'
SET ANNOTATION 'this is a excel ODBC datasource created using DSL api'\"]"
-u "admin:admin" -X POST "http://localhost:9400/rest/execute/v1/actions/dsl/invoke" -H "Content-Type:application/json"
//specify create ds using native properties only --expect warning messages in logs
curl -d "[\"CREATE DATASOURCE /shared/examples/nativeexcelds4
BASED ON ADAPTER 'Microsoft Excel'
SET NATIVE PROPERTIES {\\\"dsn\\\":\\\"excelodbc\\\", \\\"charset\\\":\\\"utf-8\\\"}
SET ANNOTATION 'this is a excel datasource created using DSL api native properties'\"]"
-u "admin:admin" -X POST "http://localhost:9400/rest/execute/v1/actions/dsl/invoke" -H "Content-Type:application/json"