SOLVED
Home

Need to extract values from named cells (Get and Transform)

%3CLINGO-SUB%20id%3D%22lingo-sub-1039592%22%20slang%3D%22en-US%22%3ENeed%20to%20extract%20values%20from%20named%20cells%20(Get%20and%20Transform)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1039592%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3EI%20have%20made%20an%20Get%20and%20Transform%20Query%20on%20a%20folder%20with%20many%20subfolders%20all%20containing%20an%20workbook%20with%20the%20first%20sheet%20named%20%22Endringsmelding%22%20in%20each.%20These%20sheets%20contains%203%20named%20cells%3A%20K5%3D%22EM%22%2C%20B11%3D%20%22Beskrivelse%22%20and%20L94%3D%20%22Total%22.%3C%2FP%3E%3CP%3EI%20need%20to%20get%20those%20values%20in%20the%20named%20cells%20out%20and%20presentet%20in%20the%20workbook%20%22Test%22%20that%20I%20have%20Attached.%3C%2FP%3E%3CP%3EI%20have%20run%20the%20Get%20and%20Transfom%20Query%2C%20have%20the%20right%20folder%20as%20Source%2C%20so%20far%20so%20good.%20My%20problem%20is%20that%20I%20do%20not%20find%20any%20Reference%20to%20how%20to%20add%20New%20Columns%20with%20the%20values%20from%20the%20named%20cells%3F%3C%2FP%3E%3CP%3EAny%20help%20will%20be%20greatly%20appreciated.%3C%2FP%3E%3CP%3EBest%20regards%3C%2FP%3E%3CP%3EJesper%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1039592%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%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1039601%22%20slang%3D%22en-US%22%3ERe%3A%20Need%20to%20extract%20values%20from%20named%20cells%20(Get%20and%20Transform)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1039601%22%20slang%3D%22en-US%22%3E-%20will%20it%20be%20an%20issue%20that%20I%20use%20a%20Norwegian%20Version%20of%20Excel%20365%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1039656%22%20slang%3D%22en-US%22%3ERe%3A%20Need%20to%20extract%20values%20from%20named%20cells%20(Get%20and%20Transform)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1039656%22%20slang%3D%22en-US%22%3EHello%20using%20Norwegian%20version%20of%20Excel%20365%20doesn't%20have%20issue%20with%20what%20you're%20trying%20to%20do....%3CBR%20%2F%3E%3CBR%20%2F%3EHowever%2C%20there%20is%20only%20one%20sheet%20with%20data%20in%20the%20first%20Excel%20workbook%20uploaded%20and%20use%20question%20wasn't%20clear%20enough.%3CBR%20%2F%3E%3CBR%20%2F%3ETo%20use%20Power%20Query%2Cyour%20data%20must%20be%20arranged%20in%20the%20Excel%20way%20and%20converted%20using%20CTRL%20%2B%20T%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1039714%22%20slang%3D%22en-US%22%3ERe%3A%20Need%20to%20extract%20values%20from%20named%20cells%20(Get%20and%20Transform)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1039714%22%20slang%3D%22en-US%22%3EBy%20the%20way%2C%20is%20there%20any%20reason%20why%20I%20do%20not%20get%20any%20Intellisense%20help%20when%20using%20the%20Advanced%20editor%20for%20the%20queries%3F%20A%20setting%20maybe%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1039718%22%20slang%3D%22en-US%22%3ERe%3A%20Need%20to%20extract%20values%20from%20named%20cells%20(Get%20and%20Transform)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1039718%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F472625%22%20target%3D%22_blank%22%3E%40JEMagnussen%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20variant%3A%3C%2FP%3E%0A%3CP%3E-%20create%20custom%20function%20which%20extract%20all%20named%20values%20from%20defined%20file%3A%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E(pFilePath%20as%20text)%20%3D%26gt%3B%0Alet%0A%20%20%20%20Source%20%3D%20Excel.Workbook(File.Contents(pFilePath)%2C%20null%2C%20true)%2C%0A%20%20%20%20DefinedNamesOnly%20%3D%20Table.SelectRows(%0A%20%20%20%20%20%20%20%20Source%2C%0A%20%20%20%20%20%20%20%20each%20(%5BKind%5D%20%3D%20%22DefinedName%22)%0A%20%20%20%20)%2C%0A%20%20%20%20ExpandThem%20%3D%20Table.ExpandTableColumn(%0A%20%20%20%20%20%20%20%20DefinedNamesOnly%2C%0A%20%20%20%20%20%20%20%20%22Data%22%2C%0A%20%20%20%20%20%20%20%20%7B%22Column1%22%7D%2C%20%7B%22Column1%22%7D%0A%20%20%20%20)%2C%0A%20%20%20%20RemoveUnused%20%3D%20Table.SelectColumns(%0A%20%20%20%20%20%20%20%20ExpandThem%2C%0A%20%20%20%20%20%20%20%20%7B%22Name%22%2C%20%22Column1%22%7D%0A%20%20%20%20)%2C%0A%20%20%20%20TransposeTable%20%3D%20Table.Transpose(RemoveUnused)%2C%0A%20%20%20%20PromotHeaders%20%3D%20Table.PromoteHeaders(%0A%20%20%20%20%20%20%20%20TransposeTable%2C%0A%20%20%20%20%20%20%20%20%5BPromoteAllScalars%3Dtrue%5D%0A%20%20%20%20)%2C%0A%20%20%20%20ProperType%20%3D%20Table.TransformColumnTypes(%0A%20%20%20%20%20%20%20%20PromotHeaders%2C%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%22Beskrivelse%22%2C%20type%20text%7D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%22EM%22%2C%20Int64.Type%7D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%22Total%22%2C%20Int64.Type%7D%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20)%0Ain%0A%20%20%20%20ProperType%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EIn%20another%20query%20use%20From%20folder%20connection%2C%20add%20column%20with%20full%20path%5Cfilename%20for%20each%20file%2C%20when%20another%20custom%20column%20with%20call%20of%20above%20function%20with%20previous%20value%20as%20parameter.%20Remove%20all%20other%20columns%20and%20expand%20this%20one.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20375px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F159421i0CB786780A87089D%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22image.png%22%20title%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EI%20copy%20your%20source%20file%20and%20test%20with%20folder%20c%3A%5Ctest.%20Please%20check%20attached.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1039721%22%20slang%3D%22en-US%22%3ERe%3A%20Need%20to%20extract%20values%20from%20named%20cells%20(Get%20and%20Transform)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1039721%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F472625%22%20target%3D%22_blank%22%3E%40JEMagnussen%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20my%20knowledge%20editor%20with%20Intelligent%20so%20far%20is%20only%20for%20insiders%20channel%20-%20Insiders%20Fast%20and%20Monthly%20Targeted%20(aka%20Insiders%20Slow)%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1039748%22%20slang%3D%22en-US%22%3ERe%3A%20Need%20to%20extract%20values%20from%20named%20cells%20(Get%20and%20Transform)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1039748%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F421698%22%20target%3D%22_blank%22%3E%40Abiola1%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20Attached%20a%20testfile2%20where%20the%20data%20tab%20is%20an%20Excel%20table.%3C%2FP%3E%3CP%3EInside%20each%20of%20the%20listed%20files%2C%20is%20a%20worksheet%20with%203%20named%20cells.%20I%20need%20to%20list%20the%20values%20of%20those%203%20named%20cells%20in%20the%20worksheet%20%22testfile2%22.%20Prefably%20the%20named%20cells%20(ranges%3F)%20should%20be%20dynamic%2C%20so%20user%20can%20insert%20an%20extra%20row%20without%20corrupting%20th%20result.%3C%2FP%3E%3CP%3EAm%20I%20making%20any%20sence%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1039749%22%20slang%3D%22en-US%22%3ERe%3A%20Need%20to%20extract%20values%20from%20named%20cells%20(Get%20and%20Transform)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1039749%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHi%20Sergei%2C%3C%2FP%3E%3CP%3EI'm%20sure%20Your%20suggestion%20Works%2C%20but%20for%20unknown%20reason%20the%20editor%20freezes%20when%20I%20try%20to%20open%20the%20Query%20to%20change%20the%20file%20path.%3C%2FP%3E%3CP%3EIf%20I%20have%20an%20empty%20file%2C%20I'm%20also%20not%20able%20to%20use%20the%20editor.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20uploaded%20a%20New%20files%2C%20as%20the%20first%20file%20did%20not%20have%20any%20table%20in%20it.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20New%20file%20has%20the%20right%20file%20path%2C%20colud%20you%20please%20try%20to%20insert%20the%20correct%20file%20path%20and%20upload%20it%20again%20then%20I%20can%20test%20it.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBest%20regards%3C%2FP%3E%3CP%3EJesper%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1039751%22%20slang%3D%22en-US%22%3ERe%3A%20Need%20to%20extract%20values%20from%20named%20cells%20(Get%20and%20Transform)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1039751%22%20slang%3D%22en-US%22%3EOK%2C%20let's%20hope%20they%20will%20release%20Intellisense%20soon%20to%20all%20users%E2%80%A6%20%3CLI-EMOJI%20id%3D%22lia_slightly-smiling-face%22%20title%3D%22%3Aslightly_smiling_face%3A%22%3E%3C%2FLI-EMOJI%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1039767%22%20slang%3D%22en-US%22%3ERe%3A%20Need%20to%20extract%20values%20from%20named%20cells%20(Get%20and%20Transform)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1039767%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F472625%22%20target%3D%22_blank%22%3E%40JEMagnussen%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20is%20a%20screenshot%20of%20an%20earlier%20attemt%20that%20failed%20due%20to%20an%20%5BDataFormat.Error%5D%20File%20contain%20corrupted%20data...%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20656px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F159422i290F6C061B19FA26%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%222019-11-29_16-44-22.jpg%22%20title%3D%222019-11-29_16-44-22.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1039815%22%20slang%3D%22en-US%22%3ERe%3A%20Need%20to%20extract%20values%20from%20named%20cells%20(Get%20and%20Transform)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1039815%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F472625%22%20target%3D%22_blank%22%3E%40JEMagnussen%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20attached%20file%20I%20added%20FilePath%20table%20to%20have%20filepath%20as%20parameter.%20It%20extracted%20within%20the%20script%20as%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3Elet%0A%20%20%20%20SourcePath%20%3D%20Excel.CurrentWorkbook()%2C%0A%20%20%20%20GetFolderPath%20%3D%20Table.SelectRows(SourcePath%2C%20each%20(%5BName%5D%20%3D%20%22FilePath%22))%7B0%7D%5BContent%5D%7B0%7D%5BFilePath%5D%2C%0A%20%20%20%20Source%20%3D%20Folder.Files(GetFolderPath)%2C%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EI%20guess%20in%20your%20case%20that%20will%20be%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3EC%3A%5CUsers%5CJema%5CVeidekke%5CNO-ENT-GLENCORE%20Cu-Bygg%20-%20Teamdokumenter%5CIntern%20Prosjekt%20Dokumenter%5C10%20%C3%98konomi%5C10.04%20Endringer%5CEndringsmeldinger%20(EM)%5CEM%5CEM001%20-%20Tilleggsarbeid%20med%20kranfundament%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E(without%20the%20slash%20at%20the%20end%20compare%20to%20your%20test%20file)%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1039831%22%20slang%3D%22en-US%22%3ERe%3A%20Need%20to%20extract%20values%20from%20named%20cells%20(Get%20and%20Transform)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1039831%22%20slang%3D%22en-US%22%3EHi%2C%3CBR%20%2F%3EI%20have%20tried%20to%20insert%20the%20correct%20file%20path%20in%20the%20Filepath%20cell%2C%20but%20I%20get%20an%20error%20saying%3A%20%22%20The%20external%20table%20has%20an%20unexpected%20format%22%20and%20I%20still%20can't%20use%20the%20editor%20as%20it%20Locks%20up.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EThe%20reult%20form%20the%20file%20you%20uploaded%20is%20not%20quite%20the%20same%20as%20shown%20in%20the%20screenshot%20I%20send%20over%20earlier%2C%20what%20could%20be%20the%20reason%20for%20this%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1039843%22%20slang%3D%22en-US%22%3ERe%3A%20Need%20to%20extract%20values%20from%20named%20cells%20(Get%20and%20Transform)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1039843%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20again%2C%3CBR%20%2F%3EAs%20I%20can%20find%20it%20seems%20like%20the%20Query%20looks%20for%20a%20folderpath%20when%20I%20insert%20the%20correct%20path%2C%20which%20by%20the%20way%20is%20a%20folderpath%20(a%20folder%20with%20many%20subfolders%20containing%20the%20workbooks)%20-%20but%20the%20Query%20expects%20a%20%22filepath%22!%20Could%20this%20be%20the%20problem%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20by%20any%20chance%20we%20get%20it%20to%20work%2C%20the%20result%20should%20prefably%20look%20like%20the%20screenshot%20shown%20a%20few%20posts%20above.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EBest%20regards%3CBR%20%2F%3EJesper%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1039846%22%20slang%3D%22en-US%22%3ERe%3A%20Need%20to%20extract%20values%20from%20named%20cells%20(Get%20and%20Transform)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1039846%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHi%20Sergei%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EManaged%20to%20get%20the%20editor%20up%20and%20running%20on%20the%20%22fx%20GetFileFields%22%20and%20here%20I%20saw%20the%20error%2C%20have%20Attached%20a%20screenshot%20of%20the%20error%20Message.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBest%20regards%3C%2FP%3E%3CP%3EJesper%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1039847%22%20slang%3D%22en-US%22%3ERe%3A%20Need%20to%20extract%20values%20from%20named%20cells%20(Get%20and%20Transform)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1039847%22%20slang%3D%22en-US%22%3EIt%20seems%20like%20the%20Query%20does%20not%20exclude%20all%20files%20that%20are%20not%20.xlsx%20files%2C%20at%20least%20I%20now%20also%20found%20an%20error%3A%20The%20external%20table%20does%20not%20have%20expected%20format%2C%20details%3A%20xxxxxxx.JPG%3CBR%20%2F%3E%3CBR%20%2F%3EBest%20regards%3CBR%20%2F%3EJesper%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1039854%22%20slang%3D%22en-US%22%3ERe%3A%20Need%20to%20extract%20values%20from%20named%20cells%20(Get%20and%20Transform)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1039854%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F472625%22%20target%3D%22_blank%22%3E%40JEMagnussen%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EPlease%20remove%20the%20last%20back%20slash%20in%20filepath%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20831px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F159436i76838C3F665E319E%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22image.png%22%20title%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1039856%22%20slang%3D%22en-US%22%3ERe%3A%20Need%20to%20extract%20values%20from%20named%20cells%20(Get%20and%20Transform)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1039856%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHi%20Sergei%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20tried%20to%20remove%20the%20last%20backslash%2C%20first%20attempt%20was%20running%20without%20this%20backslash%20-%20but%20still%20get%20the%20error%20with%20the%20%22filepath%22%20and%20not%20%22folderpath%22%20as%20it%20need%20to%20be.%20It%20is%20a%20real%20pain%20in%20the%20rear%20that%20I%20can't%20make%20modification%20to%20the%20M%20code%20as%20the%20editor%20does%20not%20work...%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBest%20regards%3C%2FP%3E%3CP%3EJesper%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1039863%22%20slang%3D%22en-US%22%3ERe%3A%20Need%20to%20extract%20values%20from%20named%20cells%20(Get%20and%20Transform)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1039863%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F472625%22%20target%3D%22_blank%22%3E%40JEMagnussen%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20duplicated%20your%20folder%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3EC%3A%5CUsers%5CJema%5CVeidekke%5CNO-ENT-GLENCORE%20Cu-Bygg%20-%20Teamdokumenter%5CIntern%20Prosjekt%20Dokumenter%5C10%20%C3%98konomi%5C10.04%20Endringer%5CEndringsmeldinger%20(EM)%5CEM%5CEM001%20-%20Tilleggsarbeid%20med%20kranfundament%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3Eon%20my%20computer%2C%20Power%20Query%20works%20with%203%20test%20files%20inside.%20Please%20check%20with%20attached%20file.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EChecked%20once%20more%20your%20file%20and%20see%20that%20all%20files%20are%20in%20different%20folders%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20482px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F159437i418B956AB87D3127%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22image.png%22%20title%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EIs%20that%20correct%20or%20you%20use%20only%20first%20one%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1039876%22%20slang%3D%22en-US%22%3ERe%3A%20Need%20to%20extract%20values%20from%20named%20cells%20(Get%20and%20Transform)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1039876%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F472625%22%20target%3D%22_blank%22%3E%40JEMagnussen%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20so%20take%20upper%20folder%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3EC%3A%5CUsers%5CJema%5CVeidekke%5CNO-ENT-GLENCORE%20Cu-Bygg%20-%20Teamdokumenter%5CIntern%20Prosjekt%20Dokumenter%5C10%20%C3%98konomi%5C10.04%20Endringer%5CEndringsmeldinger%20(EM)%5CEM%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3Eor%20even%20more%20upper%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1039887%22%20slang%3D%22en-US%22%3ERe%3A%20Need%20to%20extract%20values%20from%20named%20cells%20(Get%20and%20Transform)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1039887%22%20slang%3D%22en-US%22%3EHi%20again%2C%3CBR%20%2F%3EWe%20use%20a%20seperate%20folder%20for%20each%20file%2C%20as%20this%20is%20a%20Collection%20of%20files%20that%20belong%20to%20that%20particular%20change-order.%20So%20far%20there%20are%20some%2065%2B%20folders%20with%20.xlsx%20files%20(plus%20various%20other%20files)%20inside%20that%20we%20need%20to%20Query%20for%20the%20result%20of%20the%203%20named%20cells%20in%20each%20file.%3CBR%20%2F%3ESo%20it%C2%B4s%20correct%20that%20the%20files%20are%20in%20a%20lot%20of%20different%20folders%20under%20the%20main%20folder%20%2FEM%3CBR%20%2F%3E%3CBR%20%2F%3EBest%20regards%3CBR%20%2F%3EJesper%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1039888%22%20slang%3D%22en-US%22%3ERe%3A%20Need%20to%20extract%20values%20from%20named%20cells%20(Get%20and%20Transform)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1039888%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F472625%22%20target%3D%22_blank%22%3E%40JEMagnussen%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20so%20your%20filepath%20shall%20be%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3EC%3A%5CUsers%5CJema%5CVeidekke%5CNO-ENT-GLENCORE%20Cu-Bygg%20-%20Teamdokumenter%5CIntern%20Prosjekt%20Dokumenter%5C10%20%C3%98konomi%5C10.04%20Endringer%5CEndringsmeldinger%20(EM)%5CEM%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EAttached%20file%20works%20if%20another%203%20folders%20are%20under%20above%20one.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1039915%22%20slang%3D%22en-US%22%3ERe%3A%20Need%20to%20extract%20values%20from%20named%20cells%20(Get%20and%20Transform)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1039915%22%20slang%3D%22en-US%22%3EThank%20you%20Sergei%2C%3CBR%20%2F%3E%3CBR%20%2F%3EI%20will%20test%20it%20out%20on%20monday%2C%20have%20a%20fine%20weekend.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EBest%20regards%3CBR%20%2F%3EJesper%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1041713%22%20slang%3D%22en-US%22%3ERe%3A%20Need%20to%20extract%20values%20from%20named%20cells%20(Get%20and%20Transform)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1041713%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F472625%22%20target%3D%22_blank%22%3E%40JEMagnussen%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHello%20Sergei%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHope%20you%20had%20a%20fine%20weekend.%20The%20file%20worked%20With%20a%20few%20modifications%2C%20I%20had%20to%20insert%202%20steps%2C%20one%20for%20sorting%20alle%20files%20as%20.xlsx%20only%20and%20another%20sorting%20as%20EM(Space)%20only%2C%20as%20this%20is%20the%20files%20from%20where%20the%20values%20are%20of%20interest.%3C%2FP%3E%3CP%3EWorking%20great%20now%2C%20thank%20you%20very%20much%20for%20Your%20kind%20assistance.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBest%20regards%3C%2FP%3E%3CP%3EJesper%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
JEMagnussen
Occasional Contributor

Hi,

I have made an Get and Transform Query on a folder with many subfolders all containing an workbook with the first sheet named "Endringsmelding" in each. These sheets contains 3 named cells: K5="EM", B11= "Beskrivelse" and L94= "Total".

I need to get those values in the named cells out and presentet in the workbook "Test" that I have Attached.

I have run the Get and Transfom Query, have the right folder as Source, so far so good. My problem is that I do not find any Reference to how to add New Columns with the values from the named cells?

Any help will be greatly appreciated.

Best regards

Jesper

23 Replies
Highlighted
- will it be an issue that I use a Norwegian Version of Excel 365?
Highlighted
Hello using Norwegian version of Excel 365 doesn't have issue with what you're trying to do....

However, there is only one sheet with data in the first Excel workbook uploaded and use question wasn't clear enough.

To use Power Query,your data must be arranged in the Excel way and converted using CTRL + T
Highlighted
By the way, is there any reason why I do not get any Intellisense help when using the Advanced editor for the queries? A setting maybe?
Highlighted

@JEMagnussen 

As variant:

- create custom function which extract all named values from defined file:

(pFilePath as text) =>
let
    Source = Excel.Workbook(File.Contents(pFilePath), null, true),
    DefinedNamesOnly = Table.SelectRows(
        Source,
        each ([Kind] = "DefinedName")
    ),
    ExpandThem = Table.ExpandTableColumn(
        DefinedNamesOnly,
        "Data",
        {"Column1"}, {"Column1"}
    ),
    RemoveUnused = Table.SelectColumns(
        ExpandThem,
        {"Name", "Column1"}
    ),
    TransposeTable = Table.Transpose(RemoveUnused),
    PromotHeaders = Table.PromoteHeaders(
        TransposeTable,
        [PromoteAllScalars=true]
    ),
    ProperType = Table.TransformColumnTypes(
        PromotHeaders,
        {
            {"Beskrivelse", type text},
            {"EM", Int64.Type},
            {"Total", Int64.Type}
        }
    )
in
    ProperType

In another query use From folder connection, add column with full path\filename for each file, when another custom column with call of above function with previous value as parameter. Remove all other columns and expand this one.

image.png

I copy your source file and test with folder c:\test. Please check attached.

Highlighted

@JEMagnussen 

To my knowledge editor with Intelligent so far is only for insiders channel - Insiders Fast and Monthly Targeted (aka Insiders Slow)

Highlighted

@Abiola1 

 

I have Attached a testfile2 where the data tab is an Excel table.

Inside each of the listed files, is a worksheet with 3 named cells. I need to list the values of those 3 named cells in the worksheet "testfile2". Prefably the named cells (ranges?) should be dynamic, so user can insert an extra row without corrupting th result.

Am I making any sence?

Highlighted

@Sergei Baklan 

Hi Sergei,

I'm sure Your suggestion Works, but for unknown reason the editor freezes when I try to open the Query to change the file path.

If I have an empty file, I'm also not able to use the editor.

 

I uploaded a New files, as the first file did not have any table in it.

 

The New file has the right file path, colud you please try to insert the correct file path and upload it again then I can test it.

 

Best regards

Jesper

Highlighted
OK, let's hope they will release Intellisense soon to all users…
Highlighted

@JEMagnussen

 

This is a screenshot of an earlier attemt that failed due to an [DataFormat.Error] File contain corrupted data...

 

 2019-11-29_16-44-22.jpg

Highlighted

@JEMagnussen 

In attached file I added FilePath table to have filepath as parameter. It extracted within the script as

let
    SourcePath = Excel.CurrentWorkbook(),
    GetFolderPath = Table.SelectRows(SourcePath, each ([Name] = "FilePath")){0}[Content]{0}[FilePath],
    Source = Folder.Files(GetFolderPath),

I guess in your case that will be

C:\Users\Jema\Veidekke\NO-ENT-GLENCORE Cu-Bygg - Teamdokumenter\Intern Prosjekt Dokumenter\10 Økonomi\10.04 Endringer\Endringsmeldinger (EM)\EM\EM001 - Tilleggsarbeid med kranfundament

(without the slash at the end compare to your test file)

 

Highlighted
Hi,
I have tried to insert the correct file path in the Filepath cell, but I get an error saying: " The external table has an unexpected format" and I still can't use the editor as it Locks up.


The reult form the file you uploaded is not quite the same as shown in the screenshot I send over earlier, what could be the reason for this?
Highlighted

Hi again,
As I can find it seems like the Query looks for a folderpath when I insert the correct path, which by the way is a folderpath (a folder with many subfolders containing the workbooks) - but the Query expects a "filepath"! Could this be the problem?

 

If by any chance we get it to work, the result should prefably look like the screenshot shown a few posts above.


Best regards
Jesper

Highlighted

@Sergei Baklan 

Hi Sergei,

 

Managed to get the editor up and running on the "fx GetFileFields" and here I saw the error, have Attached a screenshot of the error Message.

 

Best regards

Jesper

Highlighted
It seems like the Query does not exclude all files that are not .xlsx files, at least I now also found an error: The external table does not have expected format, details: xxxxxxx.JPG

Best regards
Jesper
Highlighted

@JEMagnussen 

Please remove the last back slash in filepath

image.png

 

Highlighted

@Sergei Baklan 

 

Hi Sergei,

 

I have tried to remove the last backslash, first attempt was running without this backslash - but still get the error with the "filepath" and not "folderpath" as it need to be. It is a real pain in the rear that I can't make modification to the M code as the editor does not work...

 

Best regards

Jesper

Highlighted

@JEMagnussen 

I duplicated your folder

C:\Users\Jema\Veidekke\NO-ENT-GLENCORE Cu-Bygg - Teamdokumenter\Intern Prosjekt Dokumenter\10 Økonomi\10.04 Endringer\Endringsmeldinger (EM)\EM\EM001 - Tilleggsarbeid med kranfundament

on my computer, Power Query works with 3 test files inside. Please check with attached file.

 

Checked once more your file and see that all files are in different folders

image.png

Is that correct or you use only first one?

Highlighted

@JEMagnussen 

If so take upper folder

C:\Users\Jema\Veidekke\NO-ENT-GLENCORE Cu-Bygg - Teamdokumenter\Intern Prosjekt Dokumenter\10 Økonomi\10.04 Endringer\Endringsmeldinger (EM)\EM

or even more upper

Highlighted
Hi again,
We use a seperate folder for each file, as this is a Collection of files that belong to that particular change-order. So far there are some 65+ folders with .xlsx files (plus various other files) inside that we need to Query for the result of the 3 named cells in each file.
So it´s correct that the files are in a lot of different folders under the main folder /EM

Best regards
Jesper
Highlighted
Solution

@JEMagnussen 

If so your filepath shall be

C:\Users\Jema\Veidekke\NO-ENT-GLENCORE Cu-Bygg - Teamdokumenter\Intern Prosjekt Dokumenter\10 Økonomi\10.04 Endringer\Endringsmeldinger (EM)\EM

Attached file works if another 3 folders are under above one.

Highlighted
Thank you Sergei,

I will test it out on monday, have a fine weekend.


Best regards
Jesper
Highlighted

@JEMagnussen 

Hello Sergei,

 

Hope you had a fine weekend. The file worked With a few modifications, I had to insert 2 steps, one for sorting alle files as .xlsx only and another sorting as EM(Space) only, as this is the files from where the values are of interest.

Working great now, thank you very much for Your kind assistance.

 

Best regards

Jesper

Highlighted

@JEMagnussen 

Hi Jesper, great to know you sorted this out.

Related Conversations
A problem with the Zoom level of a Tab
Tavory in Discussions on
9 Replies
Pivot table
gabriellerocha in Excel on
5 Replies
Extract data from multiple sheet into one with conditions
TheCarb1 in Excel on
4 Replies
Data Extraction
Seth Pontiff in Excel on
6 Replies
Linking Adjacent Rows
ashwinash112 in Excel on
1 Replies