I previously introduced you to the use of EXCEL’s new function Power Query to summarize the worksheets in the workbook, but the function of Power Query is far more than that. Today I will introduce it to you. More advanced merging techniques: Use Power Query to merge workbooks in folders.
As shown below, there are sales data for four regions in the "Sales" folder on the desktop. The title names in each workbook are consistent, and the order can be different. The value of the city column in each workbook is the name of the workbook, which is convenient for viewing the merge effect later.
#The operation is as follows:
Close the files in the folder, create a new workbook, click on the Data tab, [Get and Transform] group "New Query" --- "From File" --- "From Folder".
Note: When previewing the content in the cell, you should place the mouse on the blank space in the cell, not on the text. Clicking on the text will directly open the file in the cell) Since the file is directly opened from the folder The extracted files are all in binary format, so the workbook in binary format appears in the preview pane below.
#So how to convert the binary file into an ordinary table requires the use of Power Query's special programming language-M language. Here I will introduce you to a commonly used function.
Click "Custom Column" in the [General] group under the Add Column option.
In the Custom Column window, enter =Excel.Workbook([Content],true) in the "Custom Column Formula", where "[ Content]" You can click "Content" in the available column on the right, and then click on the lower right corner to insert (Note: the capitalization of the formula must not be wrong).
Formula analysis:
Excel.Workbook
Function: Return the records of the worksheet from the Excel workbook.
Parameters: Excel.Workbook(workbook as binary, optional useHeaders as nullable logical, optionaldelayTypes as nullable logical) as table
This function returns a table. The first parameter workbook is in binary format, and the second parameter is the logical value of the optional parameter. true means using the title of the original table as the new table. The title, the default is false, means replacing the title of the original worksheet with the new column name. Don't worry about the third parameter.
Here we still use the original title of the form, so fill in true. This saves the subsequent step of improving the first line of the title.
The new column is added successfully. Preview one of the cells. What is shown below is a table-style workbook. This can be directly extended to the table.
The "Data" column displays a table in Table format, including the data in the table. Here we only need to extract this column. . Click the expand button in the upper right corner of the custom column, select the expanded column "Data", and uncheck "Use original column name as prefix".
The column name becomes "Data". At this time, we preview the data in "Data", and what appears below is the original data in the table. Then extract all the data below.
Similarly click the expand button on the upper right side of the custom column, select expand all columns, and do not check "Use original column name as prefix".
In this way, we obtain the data in the worksheet by drilling layer by layer.
Finally delete the "Content" column. Select the "Content" column and right-click to delete it.
#Finally, just upload this table to the form.
Click "Close and Upload" in the [Close] group under the Home tab.
#The data will be summarized in the worksheet.
When you click the filter button in the "City" column, you will see that the data in the four workbooks are all in the table.
What happens when there is one more workbook in the folder? Try placing a new workbook "Xi'an" in this folder.
Go back to the table where you just made statistics, click [ under the data tab "Refresh All" in the Connection] group.
The city column has "Xi'an" added, which represents the data of this new workbook was added.
Summary: Power Query merges folders. As long as the titles in each worksheet are the same, it can be merged and summarized. This method does not care about the folders. Any number of workbooks can be merged. And any data changes can be updated with one click through all refresh.
Power Query is a powerful tool for EXCEL data analysis. Through simple graphical operations, combined with its own M language and through the operation recorder, it helps us to operate more data in a unified manner and quickly complete data processing and optimization. Moreover, it is faster to get started and easier to operate than VBA, and graphical operation can meet most of our needs. Everyone, hurry up and learn!
Related learning recommendations: excel tutorial
The above is the detailed content of Practical Excel skills sharing: Use Power Query to merge workbooks in folders. For more information, please follow other related articles on the PHP Chinese website!

本篇文章给大家带来了关于excel的相关知识,其中主要介绍了关于折叠表格的相关问题,就是分类汇总的功能,这样查看数据会非常的方便,下面一起来看一下,希望对大家有帮助。

在之前的文章《实用Excel技巧分享:利用 数据透视表 来汇总业绩》中,我们学习了下Excel数据透视表,了解了利用数据透视表来汇总业绩的方法。而今天我们来聊聊怎么计算时间差(年数差、月数差、周数差),希望对大家有所帮助!

本篇文章给大家带来了关于excel的相关知识,其中主要介绍了关于AGGREGATE函数的相关内容,该函数用法与SUBTOTAL函数类似,但在功能上比SUBTOTAL函数更加强大,下面一起来看一下,希望对大家有帮助。

在之前的文章《实用Word技巧分享:聊聊你没用过的“行号”功能》中,我们了解了Word中你肯定没用过的"行号”功能。今天继续实用Word技巧分享,看看Excel表格怎么借用Word进行分栏打印,快来收藏使用吧!

在之前的文章《实用Excel技巧分享:原来“定位功能”这么有用!》中,我们了解了定位功能的妙用。而今天我们聊聊合并后的单元格如何实现筛选功能,分享一种复制粘贴和方法解决这个问题,另外还会给大家分享一种合并单元格的不错的替代方式。

本篇文章给大家带来了关于excel的相关知识,其中主要介绍了关于zenmm制作倒计时牌的相关内容,使用Excel中的日期函数结合按指定时间刷新的VBA代码,即可制作出倒计时牌,下面一起来看一下,希望对大家有帮助。

本篇文章给大家带来了关于excel的相关知识,其中主要介绍了关于如何使用函数寻找总和为某个值的组合的问题,下面一起来看一下,希望对大家有帮助。

本篇文章给大家带来了关于Excel的相关知识,其中主要介绍了关于XLOOKUP函数的相关知识,包括了常规查询、逆向查询、返回多列、自动除错以及近似查找等内容,下面一起来看一下,希望对大家有帮助。


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

Dreamweaver Mac version
Visual web development tools

Notepad++7.3.1
Easy-to-use and free code editor

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft
