• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

Transform Specific Worksheet into Table|Power Query|Excel Forum|My Online Training Hub

You are here: Home / Transform Specific Worksheet into Table|Power Query|Excel Forum|My Online Training Hub

vba course banner

Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumPower QueryTransform Specific Worksheet into T…
sp_PrintTopic sp_TopicIcon
Transform Specific Worksheet into Table
Avatar
jaryszek
Member
Members
Level 0
Forum Posts: 183
Member Since:
February 1, 2019
sp_UserOfflineSmall Offline
1
October 8, 2019 - 8:28 pm
sp_Permalink sp_Print

Hi Guys,

i have Excel worksheet like:

Screenshot_21.pngImage Enlarger

and now i have to get result:

Screenshot_22.pngImage Enlarger

The biggest problem i have to merge all values columns (value_1, value_2,value_3). 

How can i do this? 

Test1.xlsx - source data

MergedExample - expected result 

 

Please help,

Best,

Jacek

sp_PlupAttachments Attachments
  • sp_PlupImage Screenshot_21.png (310 KB)
  • sp_PlupImage Screenshot_22.png (352 KB)
sp_AnswersTopicSeeAnswer See Answer
Avatar
Mynda Treacy
Admin
Level 10
Forum Posts: 4524
Member Since:
July 16, 2010
sp_UserOfflineSmall Offline
2
October 8, 2019 - 9:41 pm
sp_Permalink sp_Print

Hi Jacek,

You can append the tables. See file attached.

Mynda

Avatar
jaryszek
Member
Members
Level 0
Forum Posts: 183
Member Since:
February 1, 2019
sp_UserOfflineSmall Offline
3
October 9, 2019 - 1:36 am
sp_Permalink sp_Print sp_EditHistory

o wow very nice approach,

thank you! 

Hmm ok but when i have to select multiple files like Test1 - like for example 50 from folder i would have to do one big transformation i think.
Using Merging columns and unpivoting them, can you help also with that? 

And furthermore, how can i add workbook source name to colum? (i would to take without extension = "xlsx"). 

I attached second worbkook - i need one more column here - workbook name. 

Best Wishes,
Jacek

Avatar
jaryszek
Member
Members
Level 0
Forum Posts: 183
Member Since:
February 1, 2019
sp_UserOfflineSmall Offline
4
October 9, 2019 - 1:52 am
sp_Permalink sp_Print

Ok i am addiny my trials with this as attachment.

I combined and transformed 2 tables and merged columns for Values but i do not know what should be next. 

Please help,
Jacek

sp_PlupAttachments Attachments
  • sp_PlupImage Screenshot_23.png (252 KB)
Avatar
Mynda Treacy
Admin
Level 10
Forum Posts: 4524
Member Since:
July 16, 2010
sp_UserOfflineSmall Offline
5
October 9, 2019 - 12:32 pm
sp_Permalink sp_Print

Ah, not all of the information was provided with your first question. I suspect there is more you haven't explained, like;

1. will each file in the folder have the exact same structure (columns, rows, sheets)?

2. will the data be formatted in Excel tables or named ranges, or just random unspecified ranges as per your first example file, in which case, how will Power Query know which cells you want to consolidate and which you want to exclude?

3. will each file also have data that is redundant as there was in your example file in the first few columns?

4. will each file have only one sheet containing data you want to get?

The second sample file, PQTEST.xlsx connects to external files that I don't have, therefore I cannot see the query or data. Please provide the source files as well.

Mynda

Avatar
jaryszek
Member
Members
Level 0
Forum Posts: 183
Member Since:
February 1, 2019
sp_UserOfflineSmall Offline
6
October 9, 2019 - 5:11 pm
sp_Permalink sp_Print sp_EditHistory

Hi Mynda,

thanks for questions!

1. Yes, exact structure

2. There is no tables and ranges. PQ will use Columns without structure

3. Yes, the structure is the same and everywhere i have to take only specific columns

4. yes, only one sheet. 

External files in attachment. 

In PQTEST.xlsx i am just trying to merge Test1 and Test2 from the same folder. 

Avatar
Mynda Treacy
Admin
Level 10
Forum Posts: 4524
Member Since:
July 16, 2010
sp_UserOfflineSmall Offline
7
October 9, 2019 - 9:02 pm
sp_Permalink sp_Print

Thanks for providing the sample files. You'll see in the attached I used Get Files from Folder and that you need to duplicate the final query two more times so you have 3 queries, one for each table in the files; UpdatedName, NameAdded and NameDeleted.

The file name is automatically retained when you get files from a folder, so nothing extra to do there.

Mynda

Avatar
jaryszek
Member
Members
Level 0
Forum Posts: 183
Member Since:
February 1, 2019
sp_UserOfflineSmall Offline
8
October 10, 2019 - 12:03 am
sp_Permalink sp_Print

o wow thank you very much!

Few questions:

1. = Table.SelectRows(Source, each [Attributes]?[Hidden]? <> true) and action "Filtered hidden files".

How did you do this? 

2. When you were creating 4 queries : "NameAdded", "NameDeleted" you wre copying queries manually and deleted other files created with them together? 

(not necessery one)

 

Best,

Jacek

Avatar
Mynda Treacy
Admin
Level 10
Forum Posts: 4524
Member Since:
July 16, 2010
sp_UserOfflineSmall Offline
9
October 10, 2019 - 1:11 pm
sp_Permalink sp_Print

1. This is done by Power Query automatically when you get files from a folder.

2. The first query under the 'Other Queries' folder is created automatically when you get the files from a folder. I renamed it, then duplicated it two more times for the NameDeleted and UpdatedName queries. Then deleted the columns from each query that weren't relevant.

sp_AnswersTopicAnswer
Answers Post
Avatar
jaryszek
Member
Members
Level 0
Forum Posts: 183
Member Since:
February 1, 2019
sp_UserOfflineSmall Offline
10
October 10, 2019 - 2:04 pm
sp_Permalink sp_Print

thank you Mynda. 

Avatar
jaryszek
Member
Members
Level 0
Forum Posts: 183
Member Since:
February 1, 2019
sp_UserOfflineSmall Offline
11
October 11, 2019 - 12:18 am
sp_Permalink sp_Print

Hi Mynda,

one more thing. 
I want to input folder path into cell and pass it to power query. 

Can you help with this? 

Best,
Jacek

Avatar
Catalin Bombea
Iasi, Romania
Admin
Level 10
Forum Posts: 1826
Member Since:
November 8, 2013
sp_UserOfflineSmall Offline
12
October 11, 2019 - 2:07 am
sp_Permalink sp_Print

You can create a table with a single row that contains your folder path.

In power query, add a new line using Advanced Editor with:

FolderName = Excel.CurrentWorkbook(){[Name="Table1Name"]}[Content]{0}[Column Name],

Rplace the hardt yped path from the query with this parameter name:

Source=Folder.Files(FolderName)

Avatar
jaryszek
Member
Members
Level 0
Forum Posts: 183
Member Since:
February 1, 2019
sp_UserOfflineSmall Offline
13
November 4, 2019 - 6:03 pm
sp_Permalink sp_Print sp_EditHistory

Hi Catalin,

thank you. I tried to use what you provided but i have issues with that. 

Where exactly can i put this path? 

Can you please help and use my attached workbooks?

Please help,
Jacek

sp_PlupAttachments Attachments
  • sp_PlupImage Screenshot_7-1.png (279 KB)
Avatar
jaryszek
Member
Members
Level 0
Forum Posts: 183
Member Since:
February 1, 2019
sp_UserOfflineSmall Offline
14
November 5, 2019 - 7:27 pm
sp_Permalink sp_Print

Please help,

Jacek

Avatar
Catalin Bombea
Iasi, Romania
Admin
Level 10
Forum Posts: 1826
Member Since:
November 8, 2013
sp_UserOfflineSmall Offline
15
November 6, 2019 - 4:26 am
sp_Permalink sp_Print

Hi Jacek,

As mentioned, the cell that holds the path should be in a Table, not a regular cell.

Select L1:L2 and press Ctrl+T to create a table.

In the attached file, the table name is Table2, use it in query:

FolderName = Excel.CurrentWorkbook(){[Name="Table2"]}[Content]{0}[FolderPath],

Source=Folder.Files(FolderName)

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Sherry Fox, Alicia Greynolds, Lee Mapes
Guest(s) 10
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 873
Purfleet: 414
Frans Visser: 346
David_Ng: 306
lea cohen: 222
Jessica Stewart: 218
A.Maurizio: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
Blair Gallagher
Brandi Taylor
Hafiz Ihsan Qadir
Gontran Bage
adolfo casanova
Annestine Johnpulle
Priscila Campbell
Jeff Mikles
Aaron Butler
Maurice Petterlin
Forum Stats:
Groups: 3
Forums: 24
Topics: 6369
Posts: 27852

 

Member Stats:
Guest Posters: 49
Members: 32359
Moderators: 3
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: MOTH Support, Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.

Download A Free Copy of 100 Excel Tips & Tricks

excel tips and tricks ebook

We respect your privacy. We won’t spam you.

x