# Writing dataframes or arrays from Julia to excel file

**URL:** <https://discourse.julialang.org/t/writing-dataframes-or-arrays-from-julia-to-excel-file/112096>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [March 25, 2024, 4:11pm UTC](https://discourse.julialang.org/t/writing-dataframes-or-arrays-from-julia-to-excel-file/112096 "2024-03-25T16:11:04Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Nathan\_Boyer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nathan_boyer/32/14825_2.png) [@Nathan\_Boyer](https://discourse.julialang.org/u/Nathan_Boyer)\
**Post date:** [March 25, 2024, 5:36pm UTC](https://discourse.julialang.org/t/writing-dataframes-or-arrays-from-julia-to-excel-file/112096/5 "2024-03-25T17:36:16Z")

</div>

I answered a similar question here:

> [@Create excel file using data from two dataframes](https://discourse.julialang.org/t/create-excel-file-using-data-from-two-dataframes/110320/6):
>
> The "rw" mode is a little dangerous, especially if your Excel document contains formulas ([reference](https://github.com/felipenoris/XLSX.jl/issues/159)). Also, the do block form is more robust; it will always automatically close the file. This is how I would do it. using DataFrames, XLSX df1 = DataFrame( A = [1, 2, 3, 4, 1], B= ["M", "F", "F", "M", "O"], ) df2 = DataFrame( AA = ["aa", "bb"], AB = [10.1, 10.2], ) filepath = "./xlsxtest.xlsx" startrow = nrow(df1) + 3 startcolumn = 1 XLSX.openxlsx(filepath, mode="w") do file s…

The `anchor_cell` keyword argument must be passed a `XLSX.CellRef`. Rocco showed how to use a cell name for your anchor cell, but you can also use row and column indices as I did in the link.

---

_[View the full topic](https://discourse.julialang.org/t/writing-dataframes-or-arrays-from-julia-to-excel-file/112096)._
