电源查询:选择查询要应用于的文件的简便方法?
在我们的实验室中,我们有一个系统,许多人使用并生产出结果奇怪的TXT文件。我创建了一个清除文件的电源查询,我想与他人分享(不是很精通计算机),以便他们可以将其应用于将生成的文件。
我该怎么做才能使其他用户尽可能容易地选择他们希望将查询应用于的文件?示例:是否有一种简单的方法来创建按钮打开请求文件位置的对话框?现在,我必须编辑查询源以选择数据,此方法很笨拙,我的某些同事会感到困惑。
let
Source = Table.FromColumns({Lines.FromBinary(File.Contents("X:\foo\foo.txt"), null, null, 1252)}),
#"Removed Top Rows2" = Table.Skip(Source,32),
#"Removed Bottom Rows" = Table.RemoveLastN(#"Removed Top Rows2",16),
#"Other Steps" = ...
谢谢!
In our lab we have a system that many people uses and produces a oddly shaped txt file with the results. I created a power query that cleans the file and I would like to share this with others (not very computer savvy) so they can apply it to the files they will generate.
What can I do to make it as easy as possible for other users to select the file they want the query to be applied to? Example: is there an easy way to create button that opens a dialog requesting the file location? Right now I have to edit the query source to select the data, this approach is clunky and will be confusing for some of my colleagues.
let
Source = Table.FromColumns({Lines.FromBinary(File.Contents("X:\foo\foo.txt"), null, null, 1252)}),
#"Removed Top Rows2" = Table.Skip(Source,32),
#"Removed Bottom Rows" = Table.RemoveLastN(#"Removed Top Rows2",16),
#"Other Steps" = ...
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以直接从范围名称单元格中直接获取filepath,而无需通过函数
或想要文件提示的vba路由
1创建范围名称,here aaa
2使用vba要使用文件提示填充它
设置4个钉的命名范围,
3请参考您在VBA末尾在代码上
以刷新所有查询或特定查询或
You can directly grab a filepath from a range name cell without a function by
Or if you wanted the VBA route for file prompt
1 Create a range name, here aaa
2 Use VBA to populate it using a file prompt
3 Refer to the named range in powerquery you set up
4 Tack on code at end of VBA to refresh all queries or specific query
or
您可以将fngetParameter变成一个单线:
You can make the fnGetParameter into a one-liner:
我发现 /a>从2014年起运行良好。您在查询(fngetParameter)上编写一个函数,该功能从表中读取文件位置,然后将其馈送到处理数据的查询。
用户需要做的就是在表格上写文件位置以及名称和刷新。
我将第一个更改为PowerQuery代码上的行,看起来像这样:
有什么建议以使其变得更好?
I found this post from 2014 that works pretty well. You write a function on Query (fnGetParameter) that reads the file location from a table and then you feed it to the query that processes the data.
All the user needs to do is write the file location on the table and name and refresh.
I changed the first to lines on my PowerQuery code to look like this:
Any suggestions to make it even better?