1
votes

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?

='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.

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.

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

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 Answers

1
votes

This was solved using Named Ranges.