如果我创建了一个从文件夹导入 XML 的 PowerQuery 函数,当文件夹中有新文件时,如何在同一个 excel 文件中重用查询以仅包含来自这些新文件的数据并将数据附加到当前表?
If I have created a PowerQuery function that imports XML from a folder, how in the same excel file do I reuse the query when there are new files in the folder to only include data from those new files and append the data to the current table?
推荐答案如果您使用 From File/From Folder 启动 Power Query 并浏览到您的文件夹,您将看到每个文件都表示为表中的行,包含 Date modified 等列.您可以使用修改日期的日期/时间过滤器过滤该列表,或者在必要时通过更复杂的方式过滤该列表(发布您的具体要求,我会尝试引导您朝着正确的方向前进).
If you start a Power Query using From File / From Folder and browse to your folder, you will see each file represented as a row in a table, with columns such as Date modified. You can filter that list using Date/Time filters on Date modified or by something more complicated if necessary (post your specific requirements and I'll try to steer you in the right direction).
一旦您将查询过滤为新文件",您就可以将 [Content] 列传递给您的函数.
Once you have filtered the query to just the "new files", you can pass the [Content] column into your Function.
最后,根据您预先存在的查询中保存的 Excel 表输出以及上面的新文件"查询,附加一个新查询,以获得您的组合输出.新查询将设置为 Load To/Only Create Connection.
Finally Append a new query based on the saved Excel Table output from your pre-existing query together with the "new files" query above to get your combined output. The new query would be set to Load To / Only Create Connection.
更多推荐
PowerQuery
发布评论