基于其他文件拆分Excel文件
我有2个Excel文件。寻找使用Office脚本和电源自动化的解决方案。
文件1:包含存储日期的主文件(列a =商店,B =产品,C列到Z列包含销售数据)。
文件2:带有帐户管理器的存储列表(列a =客户经理,列B =商店)
如何在多个文件中将文件1拆分(每个客户经理1)?
谢谢!
问候, 汉斯
I have 2 Excel files. Looking for a solution using Office script and Power automate.
File 1: master file containing store date (column A = store, column B = product, column C to Z contains sales data).
File 2: store list with an account manager (column A = account manager, column B = store)
How can i split file 1 in multiple files (1 per account manager)?
Thanks!
Regards,
Hans
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用参数并在Office脚本中返回值以在功率自动流量中传递往返和Excel Workbook的数据。这些样本可能会为您提供帮助:
基本上,您创建的流程应该看起来像这样:

您的流程将运行一个脚本以获取列表Manager/Store列表配对中的配对。对于每个经理,第二个脚本将在文件1上运行,该脚本将接收客户经理负责的商店(从第一个脚本返回并在第二个脚本中作为参数发送)为了寻找匹配行。然后,该脚本将返回匹配文件1中的商店列表参数的行。接下来,将在您所需的位置创建模板文件的副本,另一个脚本将运行以添加从上一个脚本返回的行中的行中文件。
以下是我创建的脚本以自动化此工作流程,但是您可以以多种方式这样做。
获取经理和存储对:
获取商店数据脚本:
将数据添加到存储特定的工作簿脚本:
希望这会有所帮助,并让我知道您是否有任何疑问!
You can use parameters and return values in an Office Script to pass data to and from and Excel workbook in a Power Automate Flow. These samples may help you:
Basically, your Flow that you create should look something like this:

Your Flow will run a script to get the list of manager/store list pairings in File 2. For each manager, a second script will run on File 1 that will take the stores that the account manager is responsible for (returned from the first script and sent as a parameter in the second script) in order to look for the matching rows. Then, that script will return the rows matching the store list parameter in File 1. Next, a copy of a template file will be created in your desired location, and another script will run to add the rows returned from the previous script to that new file.
Below are the scripts I created to automate this workflow, but you could do so in a variety of ways.
Get Manager and Store Pairs:
Get Store Data Script:
Add Data to Store Specific Workbooks Script:
Hope this helps and let me know if you have any questions!