Power-Query-Excel-Formats
Power-Query-Excel-Formats copied to clipboard
Replace argument FullPath with FileContent
Hi Max, I tried to use this function in one of my solutions. However, current version cannot be used for Scheduled Refresh as Power BI can't determine data source.
I changed function - replaced argument FullPath with FileContent.
So, in query it look like
FullPath = "C:\Temp\File.xlsx"
file = File.Contents(FullPath)
Source = fGetNumberFormats( file , "SheetName", 1, true)
... and so one...
Scheduled refresh works fine with such structure.
BR, Ivan
Hi Ivan! Thank you for the comment. I never used PBI Scheduled Refresh with local files so never met this issue.
As far as I can see you talk about Excel.GetNumberFormats.pq function. FullPath argument used in several places there, for example, there:
UnZipped = Table.Buffer(UnZip(File.Contents(FullPath)))
and there
SourceSheets =
let
Source = Excel.Workbook(File.Contents(FullPath), null, true),
I think we could use a switch with the check for 1st argument - if it is text then use it as a full path (as intended), if it is binary then use it as a File.Contents
Using a File.Contents output by default as the 1st argument seems to be too complicated for users (although the function itself is also complex, but can be used as copy-paste solution).
@IvanBond, could you please make a PR to this project, so I could see the full stack of changes needed?
Good idea to make "any" argument
I think we could use a switch with the check for 1st argument - if it is text then use it as a full path (as intended), if it is binary then use it as a File.Contents
I'll change the code and make a PR.