# Export Data Frames into Multiple Excel Sheets in R

Export Data Frames into Multiple Excel Sheets in R, To export numerous data frames from R to multiple Excel worksheets, use the following basic syntax.

How to calculate Scheffe’s Test in R » finnstats

```library(openxlsx)
names <- list('Sheet1' = df1, 'Sheet2' = df2, 'Sheet3' = df3)
write.xlsx(names, file = 'data.xlsx')```

## Export Data Frames into Multiple Excel Sheets in R

The example below demonstrates how to utilize this syntax in practice.

Exporting Multiple Data Frames to Multiple Excel Sheets is an example.

Let’s pretend we have the following three R data frames.

Plot Differences in Two Measurements-Bland-Altman Plot in R » finnstats

```df1 = data.frame(Mark=c(21, 102, 13, 88),
ID=c('AA', 'BB', 'BB', 'CC'))```
```df2 = data.frame(Mark=c(100, 120, 121, 154),
```df3 = data.frame(Mark=c(11, 42, 55, 64),
points=c(17, 14, 22, 24))```

To export all three of these data frames to distinct sheets within the same Excel file, use the following syntax.

How to measure quality control charts? (finnstats.com)

`library(openxlsx)`

We may now give each data frame a unique sheet name.

`names <- list('Sheet1' = df1, 'Sheet2' = df2, 'Sheet3' = df3)`

We may now export each data frame to its own sheet within the same Excel file.

Binomial Distribution in R-Quick Guide » finnstats

`openxlsx::write.xlsx(names, file = 'data.xlsx')`

Now we can view each of the data frames in their individual sheets within the same Excel file called data.xlsx use getwd() function to identify the file location the Excel sheet was exported.

Sheet1: Sheet2: Sheet3: In this example, we exported three data frames to three independent Excel sheets, but the same syntax can be used to export any number of data frames.

You can make use of the read.xlsx package with append=TRUE function for executing the same.

How to Perform Dunnett’s Test in R » Post-hoc Test » finnstats