Hi,
Please, Im working on a "File.xls" from a folder and transform it on "Final Results".
Every month I work on new data and the patterns are the same, only the location of my "File.xls" and "Final Results" changes.
Into my "Final Results" has table named ""Location" with function CELL, that gives me the address from my current file after apply LEFT and SEARCH, like this
VALUE = LEFT(CELL("filename");SEARCH("[Ser";CELL("filename"))-1)
I add to this function a &"File.xls" concatenating with the address, like this:
VALUE = LEFT(CELL("filename");SEARCH("[Ser";CELL("filename"))-1)&"File.xls"
FINAL VALUE = C:\Users\felipe.vaz\FolderJan\File.xls
Every month I download a new "File.xls" again and copy and paste that "Final Results" to a new folder (FolderFeb) and it gives me the position where the new "File.xls" is.
I want to use the FINAL VALUE to open the new File.xls every month. But I do know how to transform the final value to use into the Excel.Workbook()
Ive tried
= Excel.Workbook(File.Contents(Table.FromRecords(Location())), null, true) tells me that unable to convert...
Any idea?
Solved! Go to Solution.
First of all you need to have a location of the file as a string in PowerQuery
Create a new query (e.g. named 'FilePath'), with syntax like this (adjust the names accordingly):
let Source = Excel.CurrentWorkbook(){[Name="Location"]}[Content], #"Changed Type" = Table.TransformColumnTypes(Source,{{"Value", type text}}), Value = #"Changed Type"{0}[Value] in Value
Disable the load for 'FilePath'
then in the query where you actually load the data use this:
=Excel.Workbook(File.Contents(FilePath), null, true)
where FilePath is the name of the query you created earlier
Proud to be a Datanaut!
First of all you need to have a location of the file as a string in PowerQuery
Create a new query (e.g. named 'FilePath'), with syntax like this (adjust the names accordingly):
let Source = Excel.CurrentWorkbook(){[Name="Location"]}[Content], #"Changed Type" = Table.TransformColumnTypes(Source,{{"Value", type text}}), Value = #"Changed Type"{0}[Value] in Value
Disable the load for 'FilePath'
then in the query where you actually load the data use this:
=Excel.Workbook(File.Contents(FilePath), null, true)
where FilePath is the name of the query you created earlier
Proud to be a Datanaut!
WOW
Thank you! Works perfectly and I learned a lot today. Cheers!
User | Count |
---|---|
21 | |
20 | |
18 | |
17 | |
14 |