Can we write a dataframe (without headers) to a specified sheet and specified cell in Excel? I have a dataframe that I want to write to a specific sheet in a spreadsheet. Consider this dataframe
df = DataFrame(Name=["aaaa","bbbb","cccc"], Type = [1,2.0,5.5])
I have a spreadsheet “MyXLfile.xlsx” which has a tab called “Required_tab”, and I want to write this dataframe df (without headers) to the cell starting A1 in this tab.
using DataFrames
using XLSX
df = DataFrame(Name=["aaaa","bbbb","cccc"], Type = [1,2.0,5.5])
XLSX.openxlsx("MyXLfile.xlsx",mode="rw") do xf
XLSX.addsheet!(xf,"Required_tab")
sheet = xf["Required_tab"]
for r in 1:size(df,1), c in 1:size(df,2)
sheet[XLSX.CellRef(r , c )] = df[r,c]
end
end