从一个电子表格中提取数据并将其插入到模板中?

Pulling data from one spreadsheet and inserting it into a template?

我正在寻找一种方法来获取一个充满数据的电子表格并将其移动到另一个设置为人造机架图的电子表格中。

例如,我想将数据格式设置为:

+------+---+-------------+-------+---------+-------+
| Rack | U | Service Tag | Model | Project | Owner |
+------+---+-------------+-------+---------+-------+

并插入新电子表格,其中 "Rack" 是预先存在的列 header,"U" 是第一列中的值,其他四个单元格合并为一个细胞。所以:

+-----+----+---------+--------+---------+----------+
| 566 | 36 | 1234567 | Server | Project | John Doe |
+-----+----+---------+--------+---------+----------+

将转换为:

+-----+-----+-----+-----+-----+----------+-----+-----+-----+
|  U  | 001 | 002 | ... | 555 |    566   | 567 | ... |  n  |
+-----+-----+-----+-----+-----+----------+-----+-----+-----+
| 042 |     |     |     |     |          |     |     |     |
+-----+-----+-----+-----+-----+----------+-----+-----+-----+
| 041 |     |     |     |     |          |     |     |     |
+-----+-----+-----+-----+-----+----------+-----+-----+-----+
| ... |     |     |     |     |          |     |     |     |
+-----+-----+-----+-----+-----+----------+-----+-----+-----+
| 037 |     |     |     |     |          |     |     |     |
+-----+-----+-----+-----+-----+----------+-----+-----+-----+
| 036 |     |     |     |     | John Doe |     |     |     |
|     |     |     |     |     | Server   |     |     |     |
|     |     |     |     |     | Project  |     |     |     |
|     |     |     |     |     | 1234567  |     |     |     |
+-----+-----+-----+-----+-----+----------+-----+-----+-----+
| 035 |     |     |     |     |          |     |     |     |
+-----+-----+-----+-----+-----+----------+-----+-----+-----+
| ... |     |     |     |     |          |     |     |     |
+-----+-----+-----+-----+-----+----------+-----+-----+-----+
| 002 |     |     |     |     |          |     |     |     |
+-----+-----+-----+-----+-----+----------+-----+-----+-----+
| 001 |     |     |     |     |          |     |     |     |
+-----+-----+-----+-----+-----+----------+-----+-----+-----+

其中第一行和第一列已经定义。

有什么方法可以自动执行此操作,还是我只能手动执行?

如果需要移植的条目不超过 900 个,我手动执行此操作没有问题。

"simple" 简单 vlookup() 公式 对我来说似乎有点低估了。假设您的矩阵在 A1 中与 U 不同 sheet,然后在 B2 中上下复制以适应:

=IFERROR(VLOOKUP(B&"|"&$A2,Sheet1!$H:$I,2,0),"")  

with wrapping 应该可以工作,前提是你的数据 sheet(比如 Sheet1 with ColumnA for Rack)在 H1 中有:

=A1&"|"&TEXT(B1,"000")  

在 I1 中:

=F1&CHAR(10)&D1&CHAR(10)&E1&CHAR(10)&C1  

将两者都复制下来以适应。