Open In App

How to Import, Edit, Load and Consolidate Data in Excel Power Query?

Last Updated: 27 Feb, 2023

D

Summarize
Comments
Improve
Suggest changes
Like Article
Like
Share
Report
News Follow

Power Query is an easy and efficient way of solving simple data tasks. Most of our valuable time is frequently consumed by tedious manual procedures like cut and paste, column merging, and filtering. These operations are greatly simplified with the Power Query tool.

A further advantage is that, in comparison to other BI tools, Power Query is simple to use. The Power Query user interface is straightforward. Given how much it resembles the Excel interface, many users will find it to be familiar.

What is Power Query?

Power Query is an application for preparing and transforming data. Using Power Query, you may perform transformations to data obtained from sources using a Power Query Editor and a graphical user interface. 

We can import data from a variety of sources, clean it, convert it, and then reshape it to suit our needs using Power Query, a business intelligence tool provided by Microsoft Excel. Power Query allows us to create a query just once and reuse it later by simply refreshing it.

Different Ways to Import Data to the Excel Sheet

Excel allows importing data from a variety of sources. We will look at each of these in detail. While importing data, power query has several features and options that we can utilize.

Import data from the table

  • Open the Excel file and go to any cell.
  • Go to the Data tab on the top of the ribbon, then select from the table.
  • It will open the “create table” dialogue box.
Select from table option.

 

  • Give the range of data sources. Select ok.
create table dialog box appear.

 

Import data from the File

We can import data from a variety of files viz. workbook, CSV, XML, text, PDF, or folder. To import data from the file existing in the system, follow the following steps:

  • Go to the Data tab on the top of the ribbon and then to the Get external data group.
  • Select “from file”.
  • Select any of the file type where the data source is located.
Select from file and then choose any file type where the data source is located.

 

  • For example, click on “from workbook”.
  • Select the exact file having data and click Import.
  • Select the table source that you want to load the data from.
  • Click on load.
  • Data from the file will be visualized in tabular form in the current Excel sheet. A similar process applies to another type (CSV, text, XML, etc.) of file selection. 

Import data from the Web

  • Go to the Data tab on the top of the ribbon and then to the Get external data group.
  • Select “from web”.
Select from web option.

 

  • In the “New web query” dialogue box, type the URL link that has the data source in the address bar.
  • Click on Go. It will load the page.
Type the URL in the address bar.

 

  • Click on import.
  • It will load the whole table in the current Excel file.

Import data from the Database

  • Go to the Data tab on the top of the ribbon, then to the Get external data group.
  • Click on “from database”.
Select from database option.

 

  • Select from “SQL server database”.
  • It will prompt a dialogue box to import data from the SQL server database.
  • Enter the server’s name and click ok.
microsoft SQL database dialog box open.

 

  • In the access Microsoft SQL database dialogue box, check on “use my current credentials” and click on connect.
  • It will load the database in the current spreadsheet.
access Microsoft SQL database dialogue box open

 

Result: Once the importing process is completed, Excel will:

  • Load the data in the existing worksheet by generating a table.
  • Display the pane of “Queries & Connections”. This will show the query we have created.

How to Edit a Power Query

Power Query provides a variety of features to edit a query in the Excel workbook. In the “query options” window, we can set default settings. We can also determine if the data loaded was from a power query by checking the “Query” tab in the main ribbon. To edit a query with the power query in the workbook, follow the steps:

  • Go to the Data tab on the top of the ribbon, then to the Get External Data group.
  • Select From File and then click on From Workbook.
Select From File and then click on From Workbook.

 

  • Identify the workbook that has a data source and click on import.
Identify the workbook.

 

  • In the navigator box, select the table/ sheet that contains the data.
  • Click on Edit.
navigator dialog box appear.

 

  • It will open the query editor where we can edit the query.
 query editor open.

 

  • Once done, click on close & load.
click on close & load.

 

  • It will load the complete dataset in the current workbook, including the changes made so far.
  • Similar steps apply when loading and editing the data with other data sources, viz from the database, from the web, from other files(text/CSV/XML), or from other data sources.

Example: We will edit a column to change its data type from numbers to date.

load the complete dataset in the current workbook.

 

  • Click on the column whose data type needs to be changed.
  • Right-click on the column date and then choose change type and select date.
Right click on the column date and then choose change type and select date.

 

  • Select “replace current”. Here we will replace the existing conversion. We can also add new conversions at this step.

Other ways to edit a query

Edit Query from Data

  • To edit a query from data, locate previously loaded from the Power Query Editor.
  • Then select a cell in the data and go to Query and then click Edit.

Edit from the Queries & Connections Pane

When there are multiple queries in a workbook, the queries pane may prove to be a more convenient option.

  • Go to Data and then choose Queries & Connections.
  • Go to the Queries tab.
  • Locate the query in the list of queries, right-click on it, and then select Edit.

Edit from the Query Properties Box

  • Go to Data and then choose Data & Connections, then select the Queries tab.
  • Right-click the query you want to edit.
  • Select Properties. It will open a dialogue box.
  • Select the Definition tab in the dialogue box.
  • Select Edit Query.
edit the query

 

Query editing allows you to edit the query before completing the import process. Editing allows to

  • Determine and transform the source data column to work with.
  • Perform the modifications/ editions required to clean, and shape the data into the required transformation.

Result:

  • Load the data in the existing worksheet by generating a table.
  • Display the pane of “Queries & Connections”. This will show the query we have created.

Excel Power Query: Load Data

Power query helps to specify how and where the data we import is loaded. There are 2 different ways to apply the settings of the data loading:

  • The Query Editor.
  • The Navigator dialogue box or the dialogue box is named after the source (when working with a CSV or text file).

To load the query, follow the steps:

  • Go to data and then in Get external data group.
  • Select from the file and then choose CSV file. (Or any other source we want)
Select from file and then choose from workbook file.

 

  • Double-click on the file that has the data source. Click Import.
Identify the workbook.

 

  • It will open a navigator dialogue box.
  • Select the item that has the data tables, and it will open a preview in the panel.
  • Click on “load to”.
navigator dialog box appear.

 

  • In the dialogue box, we want to create only an existing connection, so check mark the button.
  • Click “load”.
Load to dialog box appear.

 

  • In the workbook queries pane, a connection is established as shown in the figure below.
workbook queries pane, a connection is established.

 

  • To load the data from the established connection, right-click on the connection. Select “load to”.
right click on the connection, select "load to".

 

  • It will open load to dialogue box. (As shown in previous steps)
  • Click on table to load the data set in the existing workbook.

Result:

  • Load the data in the existing worksheet by generating a table.
  • Display the pane of “Queries & Connections”. This will show the query we have created.

Excel power query: Combine the data

There are two different ways to combine the data imported from different data file sources:

  • Append data to existing table/query
  • Create new one

Consolidate Data by Creating a New Query

  • Click on Data and then select the new query option.
  • Select combine queries and then append.
Click on Data and then select new query option.

 

  • It will open the append dialogue box. In the first panel, select the main table in which data needs to be added. In the second table, select the one that needs to be appended with the primary one. Click OK.
append dialog box appear.

 

  • It will open the query editor dialogue box. Click on “close & load”.
open query editor dialog box.

 

  • It will load the table in the current sheet and in the queries panel, the appended rows will be displayed.
load the table in the current sheet and in the queries panel

 

Consolidate Data by Appending it to the Existing Query

  • To append to the existing query, select the data table or the connection in the queries pane. Right-click on the query you want to combine. Click on append.
select the data table,right click on the query and click on append.

 

  • It will open the append dialogue box with the first selection set itself. Enter the second table name you want to append.
append dialog box appear.

 

  • Click OK. It will open a query editor containing modified rows in the appended table. Click on close & load.
open query editor containing modified rows in the appended table.

 

  • This will load the existing rows in the appended query.

Result:

  • Load the data in the existing worksheet by generating a table.
  • Display the pane of “Queries & Connections”. This will show the query we have created.


D

News
Improve
Discuss
Do you want to advertise with us?Click here to know more

A

Import Export of Data in Excel

MS-Excel has one more advantage that not only the MS-Office other packages but also the outer packages can also bring data and can even send it, here we will discuss how to send data from MS-word and how to bring it to Excel. Importing Data from MS-Word to Excel Here we will discuss two ways the first one is simply copied and paste method through which data is imported to excel and the second is from the External source option in the Quick Access Toolbar. Method 1: Simple Copy and Paste method for importing data to excel from wordYou can bring an MS-Word table of any data to the excel worksheet if you have prepared any table in Word. So you can bring that table to MS-Excel just like the way it is in Word if apart from the table there is certain text or without a table, the list is been formed then you can also put the type of text and list in Excel.Data prepared in wordExcel Sheet where the data has to be imported From each Enter sign, there will be a new line starting in the worksheet.The Green Rectangular Box is a selected area if you press Enter key the cursor will shift to the next lineIf you prepare a document while keeping these points in mind, so you can bring that part
Read More

Excel - Types of Merging of Queries in Power Query

article_img
In Power Query, we have an option to Combine two tables using “Merge queries”. Merge Queries: Merge with current query with another queryMerge Queries as New: Merge with current query with another query and create New query In this article, we explore different types of merging of queries in Power Query with two tables. We will combine two years of sales data (2020 and 2021) with the key field “Cust_ID”. Implementation: Follow the below steps to implement merging of queries: Step 1: Open Power Query Editor. Step 2: Select your Query “Sales_2020”. Go to Home >> Merge Queries >> Merge Queries as New. We have six type of joins: Left Outer (all from first, matching from second)Right Outer (all from second, matching from first)Full Outer (all rows from both)Inner (Only Matching rows)Left Anti (rows only in first)Right Anti (rows only in second) Step 3: Select Second table; Select key fields “Cust_ID” in both tables; Select Left Outer (all from first, matching from second) and Press “OK”. Step 4: Above step create a new query “Merge 1” as below in your power query. Note: Sales_2021 is not a text value it is a table for each row. Step 5: Click “Sales_2021” drop down icon; M
Read More

How to Create a Relative File Path with Power Query in Excel?

article_img
In today's digital environment, sharing Excel files effectively is vital. A common issue is that Excel's Power Query uses absolute file paths, which can break when files are opened on different systems. To enhance portability and maintain data connections, it's crucial to convert these absolute paths to relative paths. This article explains how to make Excel workbooks more shareable by using Power Query to switch from absolute to relative file paths. How to Create a Relative File Path with Power Query in Excel?Why Convert Absolute Paths to Relative Paths?Problem with Absolute Path: Absolute paths can cause issues when sharing files because the path is specific to the original user's computer. Due, to this file sharing, is a big and significant issue. For example, an analyst is analyzing data in its intelligence tools source via power query from your PC, the tools work well until the files are in your PC, but stop working as soon as they are imported into the third person PC, this happens because the absolute path in the third person computer might be different, and our power query files are still searching for the old absolute path provided in my computer. To resolve this issue, on
Read More

C

Date Modifications with Power Query in Excel

A data preparation and transformation engine is Power Query. Power Query includes a Power Query Editor for implementing transformations as well as a graphical interface for obtaining data from sources. With Power Query (also referred to as Get & Transform in Excel), you may import or connect to external data and then modify that data to match your needs, for instance, by combining tables, altering the data type, or eliminating a column. When you're ready to produce charts and reports, load your query into Excel. You may periodically update the data by refreshing it. Steps to Open Power Query in Excel Step 1: First create a table in Excel. Step 2: Select the field and then navigate to the data tab on the top of the ribbon. Then select the Get data option and choose From other sources and select From Table/Range option. Step 3: Then Create Table dialog box appears. Here select the table range and then click OK. Step 4: Now you can see it converts the excel table to a power query Editor. Date modification with Power QueryAge The number of days between the specified date and the current date is determined when you choose the Age option and choose a date column. Next, you mu
Read More

Text Modifications with Power Query in Excel

article_img
In Excel, Power Query is a business intelligence tool that is used to analyze the data imported from different sources. With the help of power query, we can easily clean, transform and reshape our data as per requirement along the way of analyzing the data. In this example, we will learn about the Text Functions which can be easily used with the help of Power BI for the modification of the data. Given below are the formatting functions that can be used to create and manipulate the text values. Function Name Description Trim It is used to trim(remove) the whitespace from both ends of the text.Clean It removes the non-printable characters from the text and returns it.Merge Columns It is used to combine two or more columns into a single column using a separator.Lowercase It is used to make text lowercase.Uppercase It is used to make text uppercase.Add Prefix It is used to add prefixes to a cell or set of cells.Add Suffix It is used to add suffixes to a cell or set of cells.Capitalize Each Word It is used to change a text into proper text.Text Modifications with Power Query Step 1: Create a Database. In order to use the text operations, we will be using the following random names.  Fig
Read More

C

How to Add a Conditional Column in Power Query in Excel?

We may use Power Query to generate new columns whose values depend on one or more criteria that have been applied to existing columns in your database. The condition imposed on an existing column in the data model serves as the foundation for Power BI's conditional column. On the Add column tab, in the General category, is the Conditional column command. In this article, we are going to discuss the Conditional column in Power Query and in Power Pivot queries. Step By Step Implementation Step 1: Create an excel table with fields Roll No., Student name, and Marks. Step 2: Select a table. Then navigate to the data tab on the top of the ribbon and select the Get Data option and then go to from other sources and choose from Table/range. Step 3: Then create a Table dialog box appear. Here select the range and check my table has headers then click on OK. Step 4: Now as you can see the excel table is converted to a power query editor. Step 5: Now in the power query go to the add column tab on the top of the ribbon and here select the conditional column. Step 6: Add Conditional Column dialog box appears. Here write the new column name and then apply the if condition. Step 7: Her
Read More

How to Edit, Copy and Delete Drop Down List in Excel

article_img
Excel is a versatile tool used globally for various data management tasks, including the use of drop-down lists to simplify data entry and ensure consistency. However, there might be times when you need to modify these lists to keep up with changes in data or requirements. These essential techniques ensure your data remains consistent and accurate. This guide will walk you through how to edit, copy, and delete drop-down lists in Excel efficiently. Imagine quickly modifying Excel drop down list settings, effortlessly duplicating drop down list in Excel, and efficiently removing drop down list in Excel entries you no longer need. This guide will walk you through each step, making it simple to manage your Excel data validation list and customize drop down list in Excel to suit your need. Before exploring this article you can check how to create a dropdown in excel if don't already know. Table of Content How to Edit Drop-Down List in ExcelHow to Modify a Comma-Separated Drop-Down ListHow to Edit Drop-Down Menu Based on a Range of CellsHow to Change Drop-Down List Based on a Named RangeHow to Edit Drop-Down Menu Created From TableHow to Quickly Add or Remove Items in Drop-Down ListHow t
Read More

How to use Power Query as a Pivot Table Data Source?

article_img
Power Query is a tool that is available in Microsoft Excel that simplifies the process of importing data from different sources and sorting them into an Excel sheet in the most convenient and usable format. It is a tool in Microsoft Excel that is used to simplify the process of importing data from different source files and sorting them into an Excel sheet. It also removes the need to do the same filtering techniques to transform the same data set at different points as per requirement; the user only needs to set up a query, that is, the rules for sorting, once, and refresh the query every time you need to perform a particular action. So, you can easily use a power query once and simplify your data rather than using it again and again. The biggest advantage you get when you use the Power Query is higher efficiency. A pivot table is aggregated value such as the sum, average, minimum, and maximum of a large dataset to represent the dataset in a concise manner. Pivot tables are generally used to represent the Summary of large datasets. The input of Power Query effectively helps to put large datasets in the proper format for the pivot tables to process data. Steps to implement Power Qu
Read More

How to Import Data from Google Forms to Google Sheets [3 Methods]

article_img
Effortlessly managing data collected through Google Forms becomes even more efficient when you connect it to Google Sheets. Whether you're dealing with survey responses, event registrations, or feedback forms, linking or importing data ensures that information is organized and ready for analysis. In this guide, we'll explore three effective methods to import data from Google Forms to Google Sheets, covering automated syncing, manual imports, and straightforward copy-pasting techniques. Additionally, we’ll include advanced tips for optimizing the integration to suit your needs.How to Import Data from Google FormsTable of ContentMethod 1: Automatically Link Google Forms Responses to Google SheetsMethod 2: Manually Import Data from Google FormsMethod 3: Copy and Paste Data from Google Forms to Google SheetsAdvanced Tips for Google Forms to Sheets IntegrationMethod 1: Automatically Link Google Forms Responses to Google SheetsYou can directly link your Google Form to a Google Sheets document so that every response is automatically transferred. This method ensures that you don’t have to manually copy and paste form submissions.Step 1: Create Your Google FormTo get started, make sure you
Read More

Excel Power Pivot - Managing Data Model

article_img
Power Pivot is something that helps us in relating between two different data sets which are in two different worksheets. We can manage and relate any type of data using Power Pivot. It is used for data analysis and creates many different data models. we can collect large data from different sheets and can apply or perform any relation between them. Power Pivot is usable for tables only. If we have any dataset then we need to convert that dataset into tables before using Power Pivot. Managing Data ModelWhen data is formed by combining various sources, then those types of data are formed by  Data Modals. It is created by an existing relationship between two or more tables. It is created automatically when we import two or more tables from a database. Let's understand how to Manage Data Models using Excel Power Pivot with the help of an example. Step 1: Open Ms-Excel and save it as any name let's save it as "Managing Data Model".  Then we need to take any dataset, Let's say we take, three different datasets whose names are Orders, Products, and Return respectively. and our task is to manage the whole data in Power Pivot and find the Sum of Sales in each Region.   Dataset of OrderData
Read More
three90RightbarBannerImg