Class ExcelConnectionCollection¶
Namespace: OfficeOpenXml.Data.Connection
Assembly: EPPlus.dll
A collection of external connections in a workbook.
Inheritance¶
object ← ExcelConnectionCollection
Implements¶
IEnumerable
IEnumerable<ExcelConnection>
Inherited Members¶
object.Equals(object?, object?)
object.Equals(object?)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object?, object?)
object.ToString()
Properties¶
Count¶
Number of items in the collection.
Property Value¶
this[int]¶
Returns the connection at the supplied position.
Property Value¶
Methods¶
AddDatabase(string, string)¶
Adds a connection of type database with the specified connection string. EPPlus will set the Type of the connection to Odbc or OleDb, depending on the connection string. If you use another type, please set it manually. If the connection string is a power querty connection string, please also see PowerQuerySettings
Parameters¶
name string
The name of the connection.
connectionString string
The connection string to the database.
Returns¶
The connection
AddOlap(string, string, string)¶
Adds a connection to a OLAP data source.
Parameters¶
name string
The uniqe name of the connection
connectionString string
The connection string
command string
The command, usually the name of the qube.
Returns¶
The connection
AddPowerQuery(string, string, string)¶
Adds a power query connection with the specified connection string. EPPlus will set the Type of the connection to OleDb. A power query connection requires a connection string with the OleDb provide Microsoft.Mashup.OleDb.1 and a M-Formula containing the query. The PowerQuerySettings property will be created, if it does not exist.
Parameters¶
name string
The name of the connection.
connectionString string
The connection string to the database. Power query connection string usually uses the Microsoft.Mashup.OleDb.1 OleDb provider. For example: Provider=Microsoft.Mashup.OleDb.1;Data Source=\(Workbook\);Location="Table 1";Extended Properties=""
mFormula string
The M formulas to use for the power query connection, without the Section1 declaration. This formula is appended to the Formulas property of the PowerQuerySettings object.
Returns¶
The connection
AddText(string, FileInfo)¶
Adds a connection to a text file data source.
Parameters¶
name string
The name of the connection
sourceFile FileInfo
The path to the text file to use to import external data. Can be expressed in URI or system specific file path notation.
Returns¶
The connection
AddText(string, string)¶
Adds a connection to a text file data source.
Parameters¶
name string
The name of the connection
sourceFile string
The path to the text file to use to import external data. Can be expressed in URI or system specific file path notation.
Returns¶
The connection
AddWeb(string, string)¶
Adds a connection to a web query data source.
Parameters¶
name string
url string
Returns¶
The connection
GetEnumerator()¶
The enumerator for the collection.
Returns¶
The enmerator
Remove(ExcelConnection)¶
Removes the connection at the given position. Please note that any related Power Query formula is not removed from the Formulas by this method.
Parameters¶
connection ExcelConnection
The connection to remove.
RemoveAt(int)¶
Removes the connection at the given position. Please note that any related Power Query formula is not removed for the Formulas by this method.
Parameters¶
index int
The position of the connection to remove.