WebQueryConnection

WebQueryConnection class

Specifies the properties for a web query source. A web query will retrieve data from HTML tables, and can also supply HTTP “Get” parameters to be processed by the web server in generating the HTML by including the parameters and parameter elements.

class WebQueryConnection extends ExternalConnection;

Constructors

NameDescription
constructor(ExternalConnection)Constructs from a parent object convertible to this.

Properties

PropertyTypeDescription
isXmlbooleantrue if the web query source is XML (versus HTML), otherwise false.
isXl97booleanThis flag exists for backward compatibility with older existing spreadsheet files, and is set to true if this web query was created in Microsoft Excel 97. This is an optional attribute that can be ignored.
isXl2000booleanThis flag exists for backward compatibility with older existing spreadsheet files, and is set to true if this web query was refreshed in a spreadsheet application newer than or equal to Microsoft Excel 2000. This is an optional attribute that can be ignored.
urlstringURL to use to refresh external data.
isTextDatesbooleanFlag indicating whether dates should be imported into cells in the worksheet as text rather than dates.
isXmlSourceDatabooleanFlag indicating that XML source data should be imported instead of the HTML table itself.
poststringReturns or sets the string used with the post method of inputting data into a web server to return data from a web query.
isParsePrebooleanFlag indicating whether data contained within HTML PRE tags in the web page is parsed into columns when you import the page into a query table.
isHtmlTablesbooleanFlag indicating whether web queries should only work on HTML tables.
htmlFormatHtmlFormatHandlingTypeHow to handle formatting from the HTML source when bringing web query data into the worksheet. Relevant when sourceData is True.
isSameSettingsbooleanFlag indicating whether to parse all tables inside a PRE block with the same width settings as the first row.
editWebPagestringThe URL of the user-facing web page showing the web query data. This URL is persisted in the case that sourceData=“true” and url has been redirected to reference an XML file. Then the user-facing page can be shown in the UI, and the XML data can be retrieved behind the scenes.
isConsecutivebooleanFlag indicating whether consecutive delimiters should be treated as just one delimiter.
idnumberReadonly. Gets the id of the connection.
connectionIdnumberReadonly. Specifies The unique identifier of this connection.
sourceTypeConnectionDataSourceTypeGets or Sets the external connection DataSource type.
sSOIdstringIdentifier for Single Sign On (SSO) used for authentication between an intermediate spreadsheetML server and the external data source.
savePasswordbooleanTrue if the password is to be saved as part of the connection string; otherwise, False.
saveDatabooleanTrue if the external data fetched over the connection to populate a table is to be saved with the workbook; otherwise, false.
refreshOnLoadbooleanTrue if this connection should be refreshed when opening the file; otherwise, false.
reconnectionMethodTypeReConnectionMethodTypeSpecifies what the spreadsheet application should do when a connection fails. The default value is ReConnectionMethodType.Required.
onlyUseConnectionFilebooleanIndicates whether the spreadsheet application should always and only use the connection information in the external connection file indicated by the odcFile attribute when the connection is refreshed. If false, then the spreadsheet application should follow the procedure indicated by the reconnectionMethod attribute
odcFilestringSpecifies the full path to external connection file from which this connection was created. If a connection fails during an attempt to refresh data, and reconnectionMethod=1, then the spreadsheet application will try again using information from the external connection file instead of the connection object embedded within the workbook.
sourceFilestringUsed when the external data source is file-based. When a connection to such a data source fails, the spreadsheet application attempts to connect directly to this file. May be expressed in URI or system-specific file path notation.
isNewbooleanTrue if the connection has not been refreshed for the first time; otherwise, false. This state can happen when the user saves the file before a query has finished returning.
namestringSpecifies the name of the connection. Each connection must have a unique name.
keepAlivebooleanTrue when the spreadsheet application should make efforts to keep the connection open. When false, the application should close the connection after retrieving the information.
refreshInternalnumberSpecifies the number of minutes between automatic refreshes of the connection.
connectionDescriptionstringSpecifies the user description for this connection
isDeletedbooleanIndicates whether the associated workbook connection has been deleted. true if the connection has been deleted; otherwise, false.
credentialsMethodTypeCredentialsMethodTypeSpecifies the authentication method to be used when establishing (or re-establishing) the connection.
backgroundRefreshbooleanIndicates whether the connection can be refreshed in the background (asynchronously). true if preferred usage of the connection is to refresh asynchronously in the background; false if preferred usage of the connection is to refresh synchronously in the foreground.
parametersConnectionParameterCollectionReadonly. Gets ConnectionParameterCollection for an ODBC or web query.

Methods

MethodDescription
getClassType()Gets the type of this ExternalConnection object.
getConnectionFile()Gets the connection file.
getPowerQueryFormula()Gets the definition of power query formula.
getCommand()The string containing the database command to pass to the data provider API that will interact with the external source in order to retrieve data
setCommand(string)The string containing the database command to pass to the data provider API that will interact with the external source in order to retrieve data
getCommandType()Specifies the OLE DB command type. 1. Query specifies a cube name 2. Query specifies a SQL statement 3. Query specifies a table name 4. Query specifies that default information has been given, and it is up to the provider how to interpret. 5. Query is against a web based List Data Provider.
setCommandType(OLEDBCommandType)Specifies the OLE DB command type. 1. Query specifies a cube name 2. Query specifies a SQL statement 3. Query specifies a table name 4. Query specifies that default information has been given, and it is up to the provider how to interpret. 5. Query is against a web based List Data Provider.
getConnectionString()The connection information string is used to make contact with an OLE DB or ODBC data source.
setConnectionString(string)The connection information string is used to make contact with an OLE DB or ODBC data source.
getSecondCommand()Specifies a second command text string that is persisted when PivotTable server-based page fields are in use. For ODBC connections, serverCommand is usually a broader query than command (no WHERE clause is present in the former). Based on these 2 commands(Command and ServerCommand), parameter UI can be populated and parameterized queries can be constructed
setSecondCommand(string)Specifies a second command text string that is persisted when PivotTable server-based page fields are in use. For ODBC connections, serverCommand is usually a broader query than command (no WHERE clause is present in the former). Based on these 2 commands(Command and ServerCommand), parameter UI can be populated and parameterized queries can be constructed

constructor(ExternalConnection)

Constructs from a parent object convertible to this.

constructor(obj: ExternalConnection);

Parameters:

ParameterTypeDescription
objExternalConnectionThe parent object.

isXml

true if the web query source is XML (versus HTML), otherwise false.

isXml : boolean;

isXl97

This flag exists for backward compatibility with older existing spreadsheet files, and is set to true if this web query was created in Microsoft Excel 97. This is an optional attribute that can be ignored.

isXl97 : boolean;

isXl2000

This flag exists for backward compatibility with older existing spreadsheet files, and is set to true if this web query was refreshed in a spreadsheet application newer than or equal to Microsoft Excel 2000. This is an optional attribute that can be ignored.

isXl2000 : boolean;

url

URL to use to refresh external data.

url : string;

isTextDates

Flag indicating whether dates should be imported into cells in the worksheet as text rather than dates.

isTextDates : boolean;

isXmlSourceData

Flag indicating that XML source data should be imported instead of the HTML table itself.

isXmlSourceData : boolean;

post

Returns or sets the string used with the post method of inputting data into a web server to return data from a web query.

post : string;

isParsePre

Flag indicating whether data contained within HTML PRE tags in the web page is parsed into columns when you import the page into a query table.

isParsePre : boolean;

isHtmlTables

Flag indicating whether web queries should only work on HTML tables.

isHtmlTables : boolean;

htmlFormat

How to handle formatting from the HTML source when bringing web query data into the worksheet. Relevant when sourceData is True.

htmlFormat : HtmlFormatHandlingType;

isSameSettings

Flag indicating whether to parse all tables inside a PRE block with the same width settings as the first row.

isSameSettings : boolean;

editWebPage

The URL of the user-facing web page showing the web query data. This URL is persisted in the case that sourceData=“true” and url has been redirected to reference an XML file. Then the user-facing page can be shown in the UI, and the XML data can be retrieved behind the scenes.

editWebPage : string;

isConsecutive

Flag indicating whether consecutive delimiters should be treated as just one delimiter.

isConsecutive : boolean;

id

Readonly. Gets the id of the connection.

id : number;

connectionId

Readonly. Specifies The unique identifier of this connection.

connectionId : number;

Remarks

NOTE: This property is now obsolete. Instead, please use ExternalConnection.Id property. This property will be removed 12 months later since October 2024. Aspose apologizes for any inconvenience you may have experienced.

sourceType

Gets or Sets the external connection DataSource type.

sourceType : ConnectionDataSourceType;

sSOId

Identifier for Single Sign On (SSO) used for authentication between an intermediate spreadsheetML server and the external data source.

sSOId : string;

savePassword

True if the password is to be saved as part of the connection string; otherwise, False.

savePassword : boolean;

saveData

True if the external data fetched over the connection to populate a table is to be saved with the workbook; otherwise, false.

saveData : boolean;

refreshOnLoad

True if this connection should be refreshed when opening the file; otherwise, false.

refreshOnLoad : boolean;

reconnectionMethodType

Specifies what the spreadsheet application should do when a connection fails. The default value is ReConnectionMethodType.Required.

reconnectionMethodType : ReConnectionMethodType;

onlyUseConnectionFile

Indicates whether the spreadsheet application should always and only use the connection information in the external connection file indicated by the odcFile attribute when the connection is refreshed. If false, then the spreadsheet application should follow the procedure indicated by the reconnectionMethod attribute

onlyUseConnectionFile : boolean;

odcFile

Specifies the full path to external connection file from which this connection was created. If a connection fails during an attempt to refresh data, and reconnectionMethod=1, then the spreadsheet application will try again using information from the external connection file instead of the connection object embedded within the workbook.

odcFile : string;

sourceFile

Used when the external data source is file-based. When a connection to such a data source fails, the spreadsheet application attempts to connect directly to this file. May be expressed in URI or system-specific file path notation.

sourceFile : string;

isNew

True if the connection has not been refreshed for the first time; otherwise, false. This state can happen when the user saves the file before a query has finished returning.

isNew : boolean;

name

Specifies the name of the connection. Each connection must have a unique name.

name : string;

keepAlive

True when the spreadsheet application should make efforts to keep the connection open. When false, the application should close the connection after retrieving the information.

keepAlive : boolean;

refreshInternal

Specifies the number of minutes between automatic refreshes of the connection.

refreshInternal : number;

connectionDescription

Specifies the user description for this connection

connectionDescription : string;

isDeleted

Indicates whether the associated workbook connection has been deleted. true if the connection has been deleted; otherwise, false.

isDeleted : boolean;

credentialsMethodType

Specifies the authentication method to be used when establishing (or re-establishing) the connection.

credentialsMethodType : CredentialsMethodType;

backgroundRefresh

Indicates whether the connection can be refreshed in the background (asynchronously). true if preferred usage of the connection is to refresh asynchronously in the background; false if preferred usage of the connection is to refresh synchronously in the foreground.

backgroundRefresh : boolean;

parameters

Readonly. Gets ConnectionParameterCollection for an ODBC or web query.

parameters : ConnectionParameterCollection;

getClassType()

Gets the type of this ExternalConnection object.

getClassType() : ExternalConnectionClassType;

Returns

ExternalConnectionClassType

getConnectionFile()

Gets the connection file.

getConnectionFile() : string;

getPowerQueryFormula()

Gets the definition of power query formula.

getPowerQueryFormula() : PowerQueryFormula;

Returns

PowerQueryFormula

getCommand()

The string containing the database command to pass to the data provider API that will interact with the external source in order to retrieve data

getCommand() : string;

setCommand(string)

The string containing the database command to pass to the data provider API that will interact with the external source in order to retrieve data

setCommand(value: string) : void;

Parameters:

ParameterTypeDescription
valuestringThe value to set.

getCommandType()

Specifies the OLE DB command type. 1. Query specifies a cube name 2. Query specifies a SQL statement 3. Query specifies a table name 4. Query specifies that default information has been given, and it is up to the provider how to interpret. 5. Query is against a web based List Data Provider.

getCommandType() : OLEDBCommandType;

Returns

OLEDBCommandType

setCommandType(OLEDBCommandType)

Specifies the OLE DB command type. 1. Query specifies a cube name 2. Query specifies a SQL statement 3. Query specifies a table name 4. Query specifies that default information has been given, and it is up to the provider how to interpret. 5. Query is against a web based List Data Provider.

setCommandType(value: OLEDBCommandType) : void;

Parameters:

ParameterTypeDescription
valueOLEDBCommandTypeThe value to set.

getConnectionString()

The connection information string is used to make contact with an OLE DB or ODBC data source.

getConnectionString() : string;

setConnectionString(string)

The connection information string is used to make contact with an OLE DB or ODBC data source.

setConnectionString(value: string) : void;

Parameters:

ParameterTypeDescription
valuestringThe value to set.

getSecondCommand()

Specifies a second command text string that is persisted when PivotTable server-based page fields are in use. For ODBC connections, serverCommand is usually a broader query than command (no WHERE clause is present in the former). Based on these 2 commands(Command and ServerCommand), parameter UI can be populated and parameterized queries can be constructed

getSecondCommand() : string;

setSecondCommand(string)

Specifies a second command text string that is persisted when PivotTable server-based page fields are in use. For ODBC connections, serverCommand is usually a broader query than command (no WHERE clause is present in the former). Based on these 2 commands(Command and ServerCommand), parameter UI can be populated and parameterized queries can be constructed

setSecondCommand(value: string) : void;

Parameters:

ParameterTypeDescription
valuestringThe value to set.