Skip to content

Class ExcelPowerQuerySettings

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

Settings for power query connections. These settings are read from the CustomXml in the package with the key DataMashup

public class ExcelPowerQuerySettings

Inheritance

object ← ExcelPowerQuerySettings

Inherited Members

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

Properties

CultureCode

The culture code used to set parse numbers and dates

public string CultureCode { get; set; }

Property Value

string

Exists

If any power query settings exists in the package. Create"/>

public bool Exists { get; }

Property Value

bool

Formulas

The plain-text document that contains the Power Query Formula for each query in the spreadsheet.

It is fully specified by [MSDOCS - MLANG] except for the following special rules:

  • Only a single section is allowed and MUST be named “Section1”.
  • Section member names MUST NOT contain periods, double quotes, tabs, leading/trailing whitespace, or line/carriage returns.Also, they MUST NOT be blank or consist only of whitespace
  • All section members SHOULD be shared.
public string Formulas { get; set; }

Property Value

string

MetadataItems

A collection of meta data items to describe the power query formulas.

public List<ExcelPowerQueryMetadataItem> MetadataItems { get; }

Property Value

List<ExcelPowerQueryMetadataItem>

MetadataXml

Metadata settings for the Power Query connection. See MS-QDEFF - 2.5.1

public XmlDocument MetadataXml { get; }

Property Value

XmlDocument

Permissions

Permission settings

public ExcelPowerQueryPermissions Permissions { get; }

Property Value

ExcelPowerQueryPermissions

Methods

Create()

Create the DataMashup xml used for power query setting in the CustomXml. This will initialize the PermissionsXml, MetadataXml and Formulas properties with empty settings. This enables the possibility to add power query connections to the workbook (provider=Microsoft.Mashup.OleDb.1). Power query connections requires the M formula to be set in the Formulas under Section1 and meta data to be created in the MetadataXml.

public void Create()

LoadMetadataXml(string)

Loads meta data from a xml document formatted according to the MS-QDEFF docmument - section 2.5.1. See also MetadataXml

public void LoadMetadataXml(string xml)

Parameters

xml string

The xml document

Exceptions

ArgumentException

If the xml fails to load or does not contain any items.