Skip to content

Class ExcelConnection

Namespace: OfficeOpenXml.Data.Connection
Assembly: EPPlus.dll

Represents a connection to an external data source in a workbook.

public class ExcelConnection : DocumentPart<ExcelConnection>

Inheritance

object ← DocumentPart<ExcelConnection> ← ExcelConnection

Inherited Members

object.Equals(object?, object?)
object.Equals(object?)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object?, object?)
object.ToString()

Properties

AutoDelete

If the connection should be automatically deleted when all data features which use it are deleted.

public bool AutoDelete { get; set; }

Property Value

bool

AutomaticRefreshInterval

Specifies the interval, in minutes, at which the connection is automatically refreshed. A value of 0 means that the connection is not automatically refreshed.

public int AutomaticRefreshInterval { get; set; }

Property Value

int

Credentials

How the connection should handle credentials.

public eCredential Credentials { get; set; }

Property Value

eCredential

DataModel

If the connection is a data model connection, this property contains data model specific properties.

public ExcelConnectionDataModel DataModel { get; set; }

Property Value

ExcelConnectionDataModel

DatabaseProperties

Database specific properties for the connection. This property is null if the connection is not a database or olap connection.

public ExcelDatabaseProperties DatabaseProperties { get; }

Property Value

ExcelDatabaseProperties

Description

A description of the connection.

public string Description { get; set; }

Property Value

string

ExcludeFromRefreshAll

If the connection is not to be refreshed on Refresh All.

public bool ExcludeFromRefreshAll { get; set; }

Property Value

bool

Id

Gets or sets the unique identifier for the connection.

public int Id { get; set; }

Property Value

int

IsBackground

If the connection can be refreshed in the background.

public bool IsBackground { get; set; }

Property Value

bool

IsDeleted

If the connection has been deleted.

public bool IsDeleted { get; set; }

Property Value

bool

IsNew

If the connection has been refreshed for the first time

public bool IsNew { get; set; }

Property Value

bool

KeepAlive

If true, the connection should be kept alive by the spreadsheet application.

public bool KeepAlive { get; set; }

Property Value

bool

LastRefreshVersion

The version of the spreadsheet application when the connection was last refreshed.

public int LastRefreshVersion { get; set; }

Property Value

int

MinimumRefreshableVersion

The minimum version of the spreadsheet application that can refresh the connection.

public int MinimumRefreshableVersion { get; set; }

Property Value

int

Name

Gets or sets the name associated with the connection. Each connection should have a unique name.

public string Name { get; set; }

Property Value

string

OdcFile

The full external path to the ODC file from which the connection was created.

public string OdcFile { get; set; }

Property Value

string

OlapProperties

Olap specific properties for the connection. This property is null if the connection is not an olap connection.

public ExcelConnectionOlapProperties OlapProperties { get; }

Property Value

ExcelConnectionOlapProperties

OnlyUseConnectionFile

If the spreadsheet application should always and only use the connection information in the external connection file indicated by the OdcFile when the connection is refreshed.

public bool OnlyUseConnectionFile { get; set; }

Property Value

bool

Parameters

Parameters for the connection.

public ExcelConnectionParameters Parameters { get; }

Property Value

ExcelConnectionParameters

ReconnectionMethod

How the connection should reconnect when the connection fails

public eReconnectionMethod ReconnectionMethod { get; set; }

Property Value

eReconnectionMethod

RefreshOnLoad

If the connection should be refreshed when the workbook is loaded.

public bool RefreshOnLoad { get; set; }

Property Value

bool

SaveData

If data fetched by the connection should be saved in the workbook. Default false.

public bool SaveData { get; set; }

Property Value

bool

SavePassword

If the password for the connection should be saved in the workbook. Default false.

public bool SavePassword { get; set; }

Property Value

bool

SingleSignOnId

SSO id used for authentication for the connection.

public string SingleSignOnId { get; set; }

Property Value

string

SourceDatabaseFile

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.Can be expressed in URI or system-specific file path notation.

public string SourceDatabaseFile { get; set; }

Property Value

string

TextProperties

Text specific properties for the connection. This property is null if the conenction is not a text connection.

public ExcelTextProperties TextProperties { get; }

Property Value

ExcelTextProperties

Type

The type of data source for the connection. 1. ODBC-based source 2. DAO-based source 3. ApplicationDefined 4. Web query 5. OLEDB-based source. 6. Text-based source 7. ADO-based source 8. DSP-Document Source Provider 100-Data Model - OLEDB 101-Data Model - Data feed 102-Data Model - Worksheet Data 103-Data Model - Text data

public eConnectionDataSourceType? Type { get; set; }

Property Value

eConnectionDataSourceType?

UsedByAddin

If the connection is used by an addin component and will not be deleted with any data feature that uses it.

public bool UsedByAddin { get; set; }

Property Value

bool

WebProperties

Web specific properties for the connection. This property is null if the connection is not a web connection.

public ExcelWebProperties WebProperties { get; }

Property Value

ExcelWebProperties