• 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
    • Password Reset
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

How to get newest file from folder |Power Query|Excel Forum|My Online Training Hub

You are here: Home / How to get newest file from folder |Power Query|Excel Forum|My Online Training Hub
Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search|Last Search Results
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 QueryHow to get newest file from folder
sp_PrintTopic sp_TopicIcon
How to get newest file from folder
Avatar
missmsia

Active Member
Members
Level 0
Forum Posts: 5
Member Since:
February 18, 2019
sp_UserOfflineSmall Offline
1
February 18, 2019 - 4:04 am
sp_Permalink sp_Print

Hi All,

I'm new here and hopefully I could get some help from here.

I know how to get Excel files from a folder and create query for merging two files. Now, my question is how do I get the newest file that I save next month?

For example, I have a report I save in the folder every month and also a file named "Reason" save in the sub folder. I have created a connection on the file name "Report". And everything works perfectly. However, when next month come, I will have new file in the "Report" folder and the "Reason" folder, all format is same. So, how do I create a query that will automatically get the newest file that we need to do the work? 

 

I hope I didn't confuse you all. Thanks for your help.

Avatar
Mynda Treacy
Admin
Level 10
Forum Posts: 4450
Member Since:
July 16, 2010
sp_UserOfflineSmall Offline
2
February 18, 2019 - 7:58 am
sp_Permalink sp_Print

Hi MissMia,

Welcome to our forum.

First of all, my understanding is that 'Report' is the source data file and 'Reason' is the file containing the query.

It's not clear if you want to add the data from the new 'Report' file to the 'Reason' file each month, or keep the previous month's 'Reason' file as is, and start a new 'Reason' file for the current month that gets the current 'report' data?

Thanks,

Mynda

Avatar
missmsia

Active Member
Members
Level 0
Forum Posts: 5
Member Since:
February 18, 2019
sp_UserOfflineSmall Offline
3
February 18, 2019 - 11:21 am
sp_Permalink sp_Print

Hi Mynda,

 

Thanks for your reply. No, the Report is the file containing the query. Every month, I receive a file from manager about the late shipments. This file is on excel and it's already a table. What I have is the reason code that I keep track every month. So, lets say in January, I received the file from my manager and asked me to provide reason code to the shipments that were late. The report has sales order number, delivery number and other information. The reason file that I keep has sales order, delivery number and the reason code. I did a kind of like Vlookup thing on the report file which is if the sales order and delivery number matched, then applied the reason code. So, everything looks perfect and I had no problem creating the query. But, next month, I will have to do the same thing for February. Does it mean I have to re create the query again? The February report and reason file will be in different name but same format. And, after I done the report, I have to send it back to the manager. I thought there was an easy way to do it. 

 

Thanks again.Laugh

Avatar
Mynda Treacy
Admin
Level 10
Forum Posts: 4450
Member Since:
July 16, 2010
sp_UserOfflineSmall Offline
4
February 18, 2019 - 2:45 pm
sp_Permalink sp_Print

Thanks for clarifying, but I have further questions to help with my understanding. When you get the February file do you discard the reason codes from the January file and replace them with the February file or are these in addition to the January reasons?

If you were to use VLOOKUP for this task, would you add the February reasons to the bottom of the January reasons table or would you re-enter your VLOOKUP formulas so they pointed to the new February data only?

Mynda

Avatar
missmsia

Active Member
Members
Level 0
Forum Posts: 5
Member Since:
February 18, 2019
sp_UserOfflineSmall Offline
5
February 18, 2019 - 3:59 pm
sp_Permalink sp_Print

Mynda,

 

I was going to attach some files here but I don't know how. Anyway, this is what I did in January. I have a file for the reason code in Excel - 3 columns: Sales order number, delivery number and reason code. I save it as January Reason. When I received the report in excel file, lets call it "January Report" that needs reason code, I open that file (it's already in a table format), go to data > load and close to > create connection. Then, I go to Merge these 2 tables - merged "Reason" table with "Report" table. Then, I matched the columns with Sales order and delivery, then apply the reason code to the "January Report". So, i built a query for this. The report looks fine. I sent it to the manager.

 

Next month, I will receive a "February Report" and I will have a "February Reason" Save in the same location. What I want to know is do I need to rebuild the query like I did previous month? Or, is there a way I can just click the refresh button so the two tables will be merged? 

 

Thanks again Mynda.

Avatar
Philip Treacy
Admin
Level 10
Forum Posts: 1518
Member Since:
October 5, 2010
sp_UserOfflineSmall Offline
6
February 18, 2019 - 4:18 pm
sp_Permalink sp_Print

When you are writing your reply, there's a button below the box you are typing in marked 'Attachments'.  Click on that and then on 'Add Files' and select your file(s) for upload.

Then click on the orange 'Start Upload' button.

Finally click on 'Submit Reply'

Regards

Phil

Avatar
Mynda Treacy
Admin
Level 10
Forum Posts: 4450
Member Since:
July 16, 2010
sp_UserOfflineSmall Offline
7
February 18, 2019 - 10:10 pm
sp_Permalink sp_Print

If in February you have two new files that don't contain any queries, then you can copy the query from the January file (select it in the query pane > CTRL+C) and paste it into the February file, then edit the query in February's file so it points to the February data.

Mynda

Avatar
missmsia

Active Member
Members
Level 0
Forum Posts: 5
Member Since:
February 18, 2019
sp_UserOfflineSmall Offline
8
February 18, 2019 - 10:52 pm
sp_Permalink sp_Print

Thank you Mynda!Smile

Avatar
missmsia

Active Member
Members
Level 0
Forum Posts: 5
Member Since:
February 18, 2019
sp_UserOfflineSmall Offline
9
February 18, 2019 - 10:52 pm
sp_Permalink sp_Print sp_EditHistory

Philip,

 

OMG...how come I didn't see that button? Frown

 

Thank you! Laugh

Avatar
Philip Treacy
Admin
Level 10
Forum Posts: 1518
Member Since:
October 5, 2010
sp_UserOfflineSmall Offline
10
February 18, 2019 - 11:44 pm
sp_Permalink sp_Print

🙂

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Brian Pham, Riny van Eekelen
Guest(s) 9
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 871
Purfleet: 412
Frans Visser: 346
David_Ng: 306
lea cohen: 219
Jessica Stewart: 205
A.Maurizio: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
stuart burge
Bruce Tang Nian
Scot C
Othman AL MUTAIRI
Misael Gutierrez Sr.
Attif Ihsan
Kieran Fee
Murat Hasanoglu
Brett Dryland
Saeed Aldousari
Forum Stats:
Groups: 3
Forums: 24
Topics: 6223
Posts: 27295

 

Member Stats:
Guest Posters: 49
Members: 31920
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.