问题
I have a similar question to this one: Combine 2 Excel tables into one appending the data?
However, I am not interested in tables, but columns in worksheets.
If I have the following 2 worksheets:
I want to have a third sheet that looks like:
How do I create the third worksheet from the original two worksheets? If I add a row to one of the first two worksheets, would the third worksheet automatically update?
回答1:
Execute the following procedure for both sheets.
- Select a value in one of the columns.
- Goto the Data tab and select
From Table
in the Get and Transform group. Click OK. - In the Query Editor select
Close & Load to
from the dropdown menu Close & Load on the Home tab. In the Load To dialogbox selectOnly Create Connection
and click Load.
After doing this for both sheets, you should now see the following two queries in the Workbook Queries pane.
- Right-click on the Table1 query and select Append. Select Table2 in the bottom dropdown box. Click OK.
- In the Query Editor click Close & Load (the icon, not the dropdown menu).
You now have the table you wanted. After adding rows to Table1 and/or Table2, the new table Append1 will update when you click the Refresh button on the Data-tab.
来源:https://stackoverflow.com/questions/53089536/dynamically-combine-two-sheets-into-one