问题描述
如果我创建了从文件夹中导入XML的PowerQuery函数,那么当文件夹中存在新文件时,如果只包含那些新文件中的数据并将该数据附加到当前表?
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?
推荐答案
如果使用从文件/从文件夹进行超级查询并浏览到您的文件夹,您会看到每个文件在表中以一行表示,并带有修改日期之类的列。您可以使用修改日期上的日期/时间过滤器过滤该列表,或者在必要时过滤更复杂的内容(发布您的特定要求,我会尽力引导您朝正确的方向发展。)
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表输出以及上面的新文件查询得出合并后的输出。新查询将设置为加载到/仅创建连接。
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-文件夹查询导入新文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!