Giter VIP home page Giter VIP logo

pquery's Introduction

pquery

This is a collection of functions written in the M language for use in Microsoft Excel's Power Query plugin.

Introduction

Rather than manually adding the functions to different Excel workbooks, users can instead leave their files in any directory, and either batch import them into your workbook using Excel 2016 VBA (see my sample workbook here), or by dynamically loading them into Power Query using something like the Load() function (see Load.pq). To use Load() you'll need to add it to every applicable workbook though. You can hard-code in the path to the folder where you put the functions from this repository, or set it in the specified cell in the above-mentioned sample workbook for use in that.

To manually add the Load query, click 'From Other Sources' in the Power Query ribbon tab, select 'Blank Query' (bottom option), open the Advanced Editor in the View tab, and paste in the below snippet (after adjusting file path). Click Done, name the query 'Load', and click 'Apply & Close' in the Home tab.

If you have your M queries in files, you may well prefer to edit them from a text editor like Notepad++. With Matt Mason's language file for this you will get nice color coding too!

The main point here is that by separating universally useful functions from an individual workbook, you will feel encouraged to use more modular code, solving each common sub-problem only once, rather than remaining stuck in 'vanilla' M and resolving the same problems repeatedly.

Moreover, coding this way will also further facilitate sharing code with other Power Query users, allowing for a more collaborative environment.

Admittedly, Microsoft languages have rarely been known for encouraging open-source collaboration, and the Power Query community is currently small. But will that mean we cannot assemble a powerful code library like those of the JavaScript community?

Usage

to use M code in workbooks without having to import every query/function:

  • get and unzip this repo, or in case you'd like to contribute back, open a command prompt in your desired location (in Windows Explorer type cmd in the address bar) and run command git clone https://github.com/tycho01/pquery.git.
  • copy LoadPath.example.pq as LoadPath.pq and replace its entire content with the path where you put the query files; e.g. "D:\pquery\".
  • manually import the Load.pq and LoadPath.pq functions into your workbook, keeping their names as Load and LoadPath.
  • now use the Load function to load queries from the folder you specified. i.e. if you write Text_Between = Load("Text.Between"),, it's going to give you the function located at YOUR_PATH\Text.Between.pq.

to allow sharing your workbook:

Related Projects (feel free to add!)

For more Power Query related repos check out some of the following users (sorted alphabetically, feel free to add!):

pquery's People

Contributors

feifeidefei avatar hohlick avatar imkef avatar ivanbond avatar kiaragrouwstra avatar maxim-uvarov avatar sio avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.