Show / Hide Table of Contents

Class ExcelPowerQuerySettings

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

Inheritance
object
ExcelPowerQuerySettings
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: OfficeOpenXml.Data.Connection
Assembly: EPPlus.dll
Syntax
public class ExcelPowerQuerySettings

Properties

CultureCode

The culture code used to set parse numbers and dates

Declaration
public string CultureCode { get; set; }
Property Value
Type Description
string

Exists

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

Declaration
public bool Exists { get; }
Property Value
Type Description
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.
Declaration
public string Formulas { get; set; }
Property Value
Type Description
string

MetadataItems

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

Declaration
public List<ExcelPowerQueryMetadataItem> MetadataItems { get; }
Property Value
Type Description
List<ExcelPowerQueryMetadataItem>

MetadataXml

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

Declaration
public XmlDocument MetadataXml { get; }
Property Value
Type Description
XmlDocument

Permissions

Permission settings

Declaration
public ExcelPowerQueryPermissions Permissions { get; }
Property Value
Type Description
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.

Declaration
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

Declaration
public void LoadMetadataXml(string xml)
Parameters
Type Name Description
string xml

The xml document

Exceptions
Type Condition
ArgumentException

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

In this article
Back to top Generated by DocFX