Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace argument FullPath with FileContent #5

Open
IvanBond opened this issue May 22, 2018 · 3 comments
Open

Replace argument FullPath with FileContent #5

IvanBond opened this issue May 22, 2018 · 3 comments

Comments

@IvanBond
Copy link

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

@hohlick
Copy link
Owner

hohlick commented May 22, 2018

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).

@hohlick
Copy link
Owner

hohlick commented May 22, 2018

@IvanBond, could you please make a PR to this project, so I could see the full stack of changes needed?

@IvanBond
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Number Formats
Awaiting triage
Development

No branches or pull requests

2 participants