Skip to content

gsimardnet/PowerQueryNet

Repository files navigation

PowerQueryNet

Run Power Query M formula language from anywhere.

About

PowerQueryNet allows you to run M formulas commonly used in Power BI and Excel (aka Get & Transform) from the Command Prompt or any .NET application.

Download

Installer: PowerQueryNet.msi

Dependency: PowerQuerySdk.vsix 1.0.0.16

(Upon installation PowerQuerySdk.vsix must be in the same folder as PowerQueryNet.msi)

Samples: PowerQueryNet.Samples.zip

PQNet

PQNet is a Command Line Interface (CLI) that comes with the installation of PowerQueryNet.

Features

Export the result of a query to several formats (CSV, JSON, HTML, XML)

pqnet "#Hello World.pq" -o json

Export the result of a query to a SQL Server database

pqnet "#Hello World.pq" -s "Data Source=.\SQL2016;Initial Catalog=AdventureWorks2012;Integrated Security=SSPI" -t "dbo.HelloWorld"

Output the result of a Power BI query to file

pqnet MyReport.pbix Query1 -o csv -f result.csv

Hello, World! - PQNet (CLI)

  1. Create a new file with the following content:
let Source = "Hello, World!" in Source
  1. Save the file as helloworld.pq
  2. Run the following in the Command Prompt:
pqnet helloworld.pq

Hello, World! - .NET (C#)

  1. From your .NET project, add a reference to PowerQueryNet.Client
  2. Run the following:
var qry = new Query { Formula = "let hw = \"Hello World\" in hw" };
var pqc = new PowerQueryCommand() { ExecuteOutputFlags = ExecuteOutputFlags.Csv };
var result = pqc.Execute(qry);

Power Query App

Run queries in a standalone application PowerQueryApp

Build requirements

  • Visual Studio 2015+

To build the Setup project, WiX Toolset must be installed.

Copyright

Copyright 2019

Licensed under the MIT License