SOLVED

Updating existing sheet with new data from another workbook

%3CLINGO-SUB%20id%3D%22lingo-sub-1621364%22%20slang%3D%22en-US%22%3EUpdating%20existing%20sheet%20with%20new%20data%20from%20another%20workbook%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1621364%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20there%20all%2C%20forgive%20the%20newb%20query%2C%20I%20hope%20I%20make%20my%20problem%20clear.%3C%2FP%3E%3CP%3EI%20am%20happy%20to%20share%20the%20Workbooks%20I%20am%20referring%20to%20%3CLI-EMOJI%20id%3D%22lia_slightly-smiling-face%22%20title%3D%22%3Aslightly_smiling_face%3A%22%3E%3C%2FLI-EMOJI%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%202%20workbooks%20that%20I%20need%20to%20link%20to%20each%20other%20so%20that%20new%20data%20in%20(1)%20updates%20data%20in%20(2)%20automatically.%20I%20have%20questions%20to%20do%20with%20each.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWorkbook%201.%20%3CSTRONG%3ERawdata.xlsx.%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3EData%20source%20is%20MS%20Forms%20(Preview%2FFree%20Version)%20and%20using%20the%20%22download%20Excel%22%20option.%3C%2FP%3E%3CP%3EThe%20name%20suffix%20changes%20with%20each%20download%20eg%3A%20Rawdata%20(1-14)%20and%20next%20will%20be%20Rawdata%20(1-21)%20etc%20(Each%20of%20these%20is%20downloaded%20to%20a%20separate%20folder)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CEM%3EQuestion%201.%26nbsp%3BIs%20there%20to%20deal%20with%20name%20suffix%20change%2C%20apart%20from%20renaming%20each%20downloaded%20worksheet%3F%20seems%20clumsy%20to%20me%2C%20I'm%20hoping%20for%20an%20easier%20way.%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWorkbook%202.%20%3CSTRONG%3EAnalysis.xlsx%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3EThe%3CSTRONG%3E%20first%20tab%3C%2FSTRONG%3E%26nbsp%3B%3CSTRONG%3E%22DATA%22%20%3C%2FSTRONG%3Econtains%20filtered%20data%20sourced%20from%20%3CSTRONG%3ERawdata.xlsx%3C%2FSTRONG%3E%26nbsp%3B.%20The%20rest%20of%20the%20tabs%20source%20their%20data%20Tables%20from%20the%20%3CSTRONG%3EDATA%20tab%3C%2FSTRONG%3E.%26nbsp%3B%20%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CEM%3EQuestion%202.%20My%20problem%20apart%20from%20Question%201%20is%20that%20I%20cannot%20get%20the%20data%20from%20Rawdata.xlsx%20to%20update%20the%20DATA%20tab%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CEM%3EThe%20flow%20therefore%20is%20%3A%3C%2FEM%3E%3C%2FP%3E%3CP%3E%3CEM%3EMSForms%20Excel%20download%20-%20Rawdata.xlsx%20-%20Analysis.xlsx%20Data%20Tab%20-%20Analysis.xlsx%20to%20other%20tabs%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CEM%3EThanks%20Hugh%26nbsp%3B%26nbsp%3B%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1621364%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EBI%20%26amp%3B%20Data%20Analysis%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1621438%22%20slang%3D%22en-US%22%3ERe%3A%20Updating%20existing%20sheet%20with%20new%20data%20from%20another%20workbook%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1621438%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F767668%22%20target%3D%22_blank%22%3E%40Hewtee%3C%2FA%3E%26nbsp%3BYes%2C%20please%20share%20your%20workbooks.%20It's%20difficult%20to%20visualise%20what%20you%20are%20dealing%20with%2C%20otherwise.%26nbsp%3BSounds%20like%20a%20Power%20Query%20solution%20should%20be%20able%20to%20work%20for%20you%2C%20since%20you%20indicate%20that%20you%20download%20raw%20data%20repeatedly%20in%20one%20particular%20folder.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1622244%22%20slang%3D%22en-US%22%3ERe%3A%20Updating%20existing%20sheet%20with%20new%20data%20from%20another%20workbook%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1622244%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F403176%22%20target%3D%22_blank%22%3E%40Riny_van_Eekelen%3C%2FA%3E%26nbsp%3B%20Thank%20you%2C%20I%20will%20send%20them%20now%20%3CLI-EMOJI%20id%3D%22lia_slightly-smiling-face%22%20title%3D%22%3Aslightly_smiling_face%3A%22%3E%3C%2FLI-EMOJI%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1622316%22%20slang%3D%22en-US%22%3ERe%3A%20Updating%20existing%20sheet%20with%20new%20data%20from%20another%20workbook%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1622316%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F767668%22%20target%3D%22_blank%22%3E%40Hewtee%3C%2FA%3E%26nbsp%3BNot%20sure%20if%20I%20fully%20comprehend%20your%20issue%2C%20but%20I'll%20give%20a%20try.%3C%2FP%3E%3CP%3EWhen%20you%20load%20data%20from%20a%20folder%2C%20you%20first%20need%20to%20filter%20the%20file%20names%20that%20contain%20e.g.%20%22RawData%22.%20That%20will%20then%20give%20you%20a%20list%20of%20files%20like%20you%20describe%2C%20but%20with%20different%20suffixes.%20I%20assume%20that%20the%20latest%20downloaded%20file%20also%20has%20the%20most%20recent%20time%20stamp%20of%20them%20all.%20Then%20you%20can%20filter%20the%20most%20recent%20file%20from%20the%20%22Date%20created%22%20column%20(Date%2Ftime%20Filter%2C%20Is%20Latest)%2C%20and%20then%20press%20the%20two%20downward%20arrows%20in%20the%20Binary%20column.%20A%20few%20helper%20query%20and%20a%20RawData%20(name%20of%20the%20folder%20I%20used%20to%20test%20this)%20query%20are%20created.%20The%20latter%20contains%20the%20data%20from%20the%20most%20recent%20file.%20Do%20your%20transformations%2Ffiltering%20and%20close%20and%20load%20back%20to%20an%20Excel%20sheet%20to%20form%20the%20basis%20of%20your%20other%20sheets.%3C%2FP%3E%3CP%3ENow%2C%20add%20a%20more%20recent%20data%20file%20to%20the%20designated%20folder%2C%20making%20sure%20the%20file%20name%20contains%20%22RawData%22%20(or%20whatever%20you%20filtered%20on%20in%20the%20beginning).%20Go%20to%20the%20Excel%20table%20you%20loaded%20earlier%2C%20right-click%20in%20it%2C%20choose%20Refresh%2C%20and%20the%20most%20recent%20data%20will%20be%20loaded.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1622339%22%20slang%3D%22en-US%22%3ERe%3A%20Updating%20existing%20sheet%20with%20new%20data%20from%20another%20workbook%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1622339%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F403176%22%20target%3D%22_blank%22%3E%40Riny_van_Eekelen%3C%2FA%3E%26nbsp%3B%20Wow%20thank%20you.%20Ill%20follow%20your%20suggestions%20and%20let%20you%20know%20%3CLI-EMOJI%20id%3D%22lia_slightly-smiling-face%22%20title%3D%22%3Aslightly_smiling_face%3A%22%3E%3C%2FLI-EMOJI%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1627216%22%20slang%3D%22en-US%22%3ERe%3A%20Updating%20existing%20sheet%20with%20new%20data%20from%20another%20workbook%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1627216%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F403176%22%20target%3D%22_blank%22%3E%40Riny_van_Eekelen%3C%2FA%3E%26nbsp%3B%20More'%20meneer%20(my%20attempt%20as%20I%20speak%20Afrikaans%3A)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOk%20I%20have%20got%20everything%20working%20thanks%20to%20you%2C%20however%20I%20selected%20combine%20files%20instead%20of%20merge.%20Is%20there%20a%20way%20to%20change%20the%20existing%20query%20or%20do%20I%20have%20to%20start%20again%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20Hugh%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1627249%22%20slang%3D%22en-US%22%3ERe%3A%20Updating%20existing%20sheet%20with%20new%20data%20from%20another%20workbook%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1627249%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F767668%22%20target%3D%22_blank%22%3E%40Hewtee%3C%2FA%3E%26nbsp%3BAgain%2C%20not%20sure%20I%20follow%2C%20but%20if%20you%20intend%20to%20combine%20all%20the%20files%20(within%20a%20folder%2Fsub-folder)%20that%20contain%20%22RawData%22%20in%20the%20file%20name%2C%20just%20leave%20out%20the%20step%20that%20filters%20for%20the%20most%20recent%20file.%20Then%20all%20files%20in%20the%20folder%20that%20match%20your%20criteria%20should%20be%20picked-up%20and%20%22joined%22%20into%20one%20query%20automatically.%20Add%20a%20newer%20file%2C%20refresh%20and%20its%20data%20will%20be%20added%20to%20the%20output.%20No%20need%20to%20create%20a%20new%20query.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1628292%22%20slang%3D%22en-US%22%3ERe%3A%20Updating%20existing%20sheet%20with%20new%20data%20from%20another%20workbook%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1628292%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F403176%22%20target%3D%22_blank%22%3E%40Riny_van_Eekelen%3C%2FA%3E%26nbsp%3B%20Thanks%20again%2C%20will%20try%20%3CLI-EMOJI%20id%3D%22lia_slightly-smiling-face%22%20title%3D%22%3Aslightly_smiling_face%3A%22%3E%3C%2FLI-EMOJI%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1630485%22%20slang%3D%22en-US%22%3ERe%3A%20Updating%20existing%20sheet%20with%20new%20data%20from%20another%20workbook%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1630485%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F403176%22%20target%3D%22_blank%22%3E%40Riny_van_Eekelen%3C%2FA%3E%26nbsp%3B%20Morning.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOk%20I%20see%20what%20the%20problem%20is.%26nbsp%3B%3C%2FP%3E%3CP%3ELets%20say%20my%20first%20Workbook%20that%20I%20load%20has%2010%20rows.%20The%20next%20one%20(later%20date)%20has%2014.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhat%20the%20query%20does%20is%20add%20all%20the%20data%20into%2024%20rows%20and%20so%20its%20duplicating%20the%20common%20data%20from%20both%20workbooks.%20What%20I%20want%20is%20it%20to%20just%20%22add%22%20the%20new%20data.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20attached%20the%20file%20and%20a%20screenshot%20of%20power%20editor.%3C%2FP%3E%3CP%3EI%20an%20concerned%20that%20I%20am%20abusing%20your%20kindness%2C%20if%20so%20I%20will%20post%20this%20question%20in%20the%20forum%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1630663%22%20slang%3D%22en-US%22%3ERe%3A%20Updating%20existing%20sheet%20with%20new%20data%20from%20another%20workbook%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1630663%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F767668%22%20target%3D%22_blank%22%3E%40Hewtee%3C%2FA%3E%26nbsp%3BNo%20abuse%20at%20all.%20Looked%20at%20the%20xlsx%20file%20you%20uploaded%2C%20but%20see%20no%20query%20in%20it.%20Only%20a%20connection%20to%20a%20file%20%22RankingsRawData(1-17).xlsx%22%20on%20your%20Google%20drive.%26nbsp%3BAnd%2C%20it's%20quite%20difficult%20to%20diagnose%20a%20query%20from%20a%20picture.%20Perhaps%20the%20ID%20column%20could%20be%20helpful%20to%20identify%20and%20delete%20duplicates.%20Or%20I%20just%20don't%20get%20a%20clear%20picture%20in%20my%20mind%20of%20what%20you%20want%2Fneed.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1631147%22%20slang%3D%22en-US%22%3ERe%3A%20Updating%20existing%20sheet%20with%20new%20data%20from%20another%20workbook%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1631147%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F403176%22%20target%3D%22_blank%22%3E%40Riny_van_Eekelen%3C%2FA%3E%26nbsp%3B%20Ok%20thank%20you.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYes%20I%20also%20noticed%20no%20query!!%3CBR%20%2F%3EI've%20attached%20my%20original%20workbook%20I%20was%20working%20on%2C%20but%20this%20one%20has%20no%20connections%20only%20queries%20%3CLI-EMOJI%20id%3D%22lia_slightly-smiling-face%22%20title%3D%22%3Aslightly_smiling_face%3A%22%3E%3C%2FLI-EMOJI%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20will%20see%20that%20the%20query%20returns%20data%20from%20two%20other%20workbooks%20but%20duplicates%20the%20data.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E(I'm%20not%20sure%20if%20I%20mentioned%20but%20I%20get%20my%20data%20from%20MSForms%20and%20then%20download%20it%20as%20an%20Excel%20file%2C%20which%20contains%20all%20the%20previous%20data%20plus%20any%20new%20inputs%20to%20the%20form.)%26nbsp%3B%3C%2FP%3E%3CP%3EMy%20query%20has%20a%20filter%20in%20it%20that%20picks%20up%20any%20spreadsheet%20from%20MSForms%20with%20a%20name%20starting%20with%20GrowthPredictorRankings....%20(as%20the%20suffix%20changes%20in%20each%20download%20from%20MSForms%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20my%20main%20problem%20remains%20the%20duplication%20of%20the%20data%26nbsp%3B%20Cheers%20Hugh%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Contributor

Hi there all, forgive the newb query, I hope I make my problem clear.

I am happy to share the Workbooks I am referring to

 

I have 2 workbooks that I need to link to each other so that new data in (1) updates data in (2) automatically. I have questions to do with each.

 

Workbook 1. Rawdata.xlsx.

Data source is MS Forms (Preview/Free Version) and using the "download Excel" option.

The name suffix changes with each download eg: Rawdata (1-14) and next will be Rawdata (1-21) etc (Each of these is downloaded to a separate folder)

 

Question 1. Is there to deal with name suffix change, apart from renaming each downloaded worksheet? seems clumsy to me, I'm hoping for an easier way.

 

Workbook 2. Analysis.xlsx

The first tab "DATA" contains filtered data sourced from Rawdata.xlsx . The rest of the tabs source their data Tables from the DATA tab.   

 

Question 2. My problem apart from Question 1 is that I cannot get the data from Rawdata.xlsx to update the DATA tab

 

The flow therefore is :

MSForms Excel download - Rawdata.xlsx - Analysis.xlsx Data Tab - Analysis.xlsx to other tabs

 

Thanks Hugh  

 

10 Replies
Highlighted

@Hewtee Yes, please share your workbooks. It's difficult to visualise what you are dealing with, otherwise. Sounds like a Power Query solution should be able to work for you, since you indicate that you download raw data repeatedly in one particular folder.

Highlighted

@Riny_van_Eekelen  Thank you, I will send them now

Highlighted
Best Response confirmed by Hewtee (Occasional Contributor)
Solution

@Hewtee Not sure if I fully comprehend your issue, but I'll give a try.

When you load data from a folder, you first need to filter the file names that contain e.g. "RawData". That will then give you a list of files like you describe, but with different suffixes. I assume that the latest downloaded file also has the most recent time stamp of them all. Then you can filter the most recent file from the "Date created" column (Date/time Filter, Is Latest), and then press the two downward arrows in the Binary column. A few helper query and a RawData (name of the folder I used to test this) query are created. The latter contains the data from the most recent file. Do your transformations/filtering and close and load back to an Excel sheet to form the basis of your other sheets.

Now, add a more recent data file to the designated folder, making sure the file name contains "RawData" (or whatever you filtered on in the beginning). Go to the Excel table you loaded earlier, right-click in it, choose Refresh, and the most recent data will be loaded. 

Highlighted

@Riny_van_Eekelen  Wow thank you. Ill follow your suggestions and let you know

Highlighted

@Riny_van_Eekelen  More' meneer (my attempt as I speak Afrikaans:)

 

Ok I have got everything working thanks to you, however I selected combine files instead of merge. Is there a way to change the existing query or do I have to start again?

 

Thanks Hugh

Highlighted

@Hewtee Again, not sure I follow, but if you intend to combine all the files (within a folder/sub-folder) that contain "RawData" in the file name, just leave out the step that filters for the most recent file. Then all files in the folder that match your criteria should be picked-up and "joined" into one query automatically. Add a newer file, refresh and its data will be added to the output. No need to create a new query.

Highlighted
Highlighted

@Riny_van_Eekelen  Morning.

 

Ok I see what the problem is. 

Lets say my first Workbook that I load has 10 rows. The next one (later date) has 14.

 

What the query does is add all the data into 24 rows and so its duplicating the common data from both workbooks. What I want is it to just "add" the new data.

 

I have attached the file and a screenshot of power editor.

I an concerned that I am abusing your kindness, if so I will post this question in the forum?

Highlighted

@Hewtee No abuse at all. Looked at the xlsx file you uploaded, but see no query in it. Only a connection to a file "RankingsRawData(1-17).xlsx" on your Google drive. And, it's quite difficult to diagnose a query from a picture. Perhaps the ID column could be helpful to identify and delete duplicates. Or I just don't get a clear picture in my mind of what you want/need.

 

Highlighted

@Riny_van_Eekelen  Ok thank you.

 

Yes I also noticed no query!!
I've attached my original workbook I was working on, but this one has no connections only queries

 

You will see that the query returns data from two other workbooks but duplicates the data.

 

(I'm not sure if I mentioned but I get my data from MSForms and then download it as an Excel file, which contains all the previous data plus any new inputs to the form.) 

My query has a filter in it that picks up any spreadsheet from MSForms with a name starting with GrowthPredictorRankings.... (as the suffix changes in each download from MSForms 

 

So my main problem remains the duplication of the data  Cheers Hugh