# Writing to large excel file (.xlsm) using XLSX

**URL:** <https://discourse.julialang.org/t/writing-to-large-excel-file-xlsm-using-xlsx/60094>\
**Category:** New to Julia\
**Created:** [April 27, 2021, 10:33am UTC](https://discourse.julialang.org/t/writing-to-large-excel-file-xlsm-using-xlsx/60094 "2021-04-27T10:33:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yogi1](https://avatars.discourse-cdn.com/v4/letter/y/439d5e/32.png) [@yogi1](https://discourse.julialang.org/u/yogi1)\
**Post date:** [April 27, 2021, 10:33am UTC](https://discourse.julialang.org/t/writing-to-large-excel-file-xlsm-using-xlsx/60094/1 "2021-04-27T10:33:43Z")

</div>

Hi all,

I’m trying to pass a dataframe to a large xlsm file (80mbs). The code I’m using is as follows:

```julia
using XLSX, DataFrames
XLSX.openxlsx("xlsm_file.xlsm", mode ="rw" ) do xf
        # pass through the dataframe, df
        sheet = xf["sheet1"]
        for r in 1:size(df,1), c in 1:size(df,2)
             sheet[XLSX.CellRef(r , c )] = df[r,c]
        end
end

```

This takes a really long time and eventually crashes giving the following error:

```julia
AssertionError: isempty(XML_GLOBAL_ERROR_STACK)

```

I have rerun the code using a smaller version of the file (i.e… removing formulas, tabs etc) and the code runs ok.

I also tried updating the code to disable caching using:

```julia

XLSX.openxlsx("xlsm_file.xlsm", enable_cache = false ) do xf
        # pass through the dataframe, df
        sheet = xf["sheet1"]
        for r in 1:size(df,1), c in 1:size(df,2)
             sheet[XLSX.CellRef(r , c )] = df[r,c]
        end
end

```

But this gives:

```julia
AssertionError: XLSXFile instance is not writable.

```

Is there a way to disable caching while in “rw” mode?

Any recommendations on how to write to large excel files?  
Thanks in advance.

---

<div class="post-metadata">

**Author:** ![bernhard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bernhard/32/2619_2.png) [@bernhard](https://discourse.julialang.org/u/bernhard)\
**Post date:** [April 27, 2021, 3:45pm UTC](https://discourse.julialang.org/t/writing-to-large-excel-file-xlsm-using-xlsx/60094/2 "2021-04-27T15:45:17Z")

</div>

I have no solution for this. It is possible that a workaround via python might be a (cumbersome) solution, as some python packages are more mature (and tested) than Julia packages.  
I have written very large files with the xlsxwriter package (via PyCall).  
However I am wondering if your Excel file is really that large. Does it contain that much data?  
A high number of sheets and formulas usually does not lead to an 80mb file size. At times Excel has an ‘inflated’ file size due to unused cells or formatting issues. If you google ‘reduce excel file size unused cells’ you may find some hints to reduce the file size while maintaining all functionality and data.

---

<div class="post-metadata">

**Author:** ![TimG](https://avatars.discourse-cdn.com/v4/letter/t/82dd89/32.png) [@TimG](https://discourse.julialang.org/u/TimG)\
**Post date:** [August 29, 2026, 8:56pm UTC](https://discourse.julialang.org/t/writing-to-large-excel-file-xlsm-using-xlsx/60094/3 "2026-08-29T20:56:04Z")

</div>

> [@yogi1](#):
>
> Is there a way to disable caching while in “rw” mode?

There is not. XLSX.jl **requires** the use of the cache in write mode. On the positive side, working memory use is much lower in recent versions than it was in the past.
