如何在工作表为空的工作表中持久化Excel引用?

时间:2021-12-06 15:51:37

Is it possible in Excel to create a template with formula to other named empty sheets such that the references to the cells always remain and don't end up like this?

在Excel中,是否可能创建一个模板,将公式用于其他命名的空表,以便始终保持对单元格的引用,而不会以这种方式结束?

='Data'!#REF!

I am using python, pandas and openpyxl to populate multiple named worksheets with various pandas dataframes. The 1st, 2nd and 3rd sheets are templates with references to the other worksheets.

我正在使用python、panda和openpyxl来填充多个指定的工作表,其中包含各种panda数据堆。第1、第2和第3张是参考其他工作表的模板。

Why is this required : If I have data in the template of say 10 rows and write a dataframe of 5 rows the remaining 5 existing rows remain.

为什么需要这样做:如果我在模板中有10行数据,并且写一个5行的dataframe,剩下的5行仍然保留。

It might be possible to clear the target sheet before the to_excel but I think this may force the links to break.

可能在to_excel之前清除目标表,但我认为这可能会迫使链接中断。

I've looked at this How to preserve a formula's reference to a worksheet when the worksheet is deleted and replaced? but it seems quite tedious to have to create another indirect reference.

我已经研究过如何在删除和替换工作表时保留公式对工作表的引用?但要创造另一种间接引用似乎很乏味。

1 个解决方案

#1


1  

This was solved using Named Ranges.

这是用命名范围来解决的。

#1


1  

This was solved using Named Ranges.

这是用命名范围来解决的。