What's a robust method in R for importing from

2019-05-17 12:25发布

I've used RODBC for some time to import Excel spreadsheets with mostly good results. However I have had no luck writing to an Excel spreadsheet. Also are there favorable differences using the xlsx format with Excel2007?

5条回答
Animai°情兽
2楼-- · 2019-05-17 12:28

XLConnect works well. It is cross-platform. It can read and write xls and xlsx files. See this previous answer

查看更多
地球回转人心会变
3楼-- · 2019-05-17 12:28

This question is 3 years old, but I'll throw this in: if you want to write to the spreadsheet, remember to add readOnly=FALSE as an argument to odbcConnectExcel and odbcConnectExcel2007.

查看更多
Fickle 薄情
4楼-- · 2019-05-17 12:30

The R Data Import/Export manual should be considered the best source of advice for these questions.

For reading you can indeed use the RODBC package. An easier solutoion may be read.xls() from the gdata

For writing you can use one of the wrapper packages such as WriteXLS which wraps around Perl libraries that know how to write in the proprietary and not formally documented xls format.

In general, xlsx will not be a solution as this format is newer, once again proprietary and not documented. For that reason there are even fewer tools coping with this.

查看更多
Animai°情兽
5楼-- · 2019-05-17 12:40

I've used the technique described here: Export Data Frames To Multi-worksheet Excel File

查看更多
淡お忘
6楼-- · 2019-05-17 12:50

There is a package that may help with dealing with excel 2007, but I haven't tried it.

http://www.omegahat.org/RExcelXML/

查看更多
登录 后发表回答