Looking for a clear description of Excel’s .xlsx XML format [closed]

This PowerPoint deck, entitled “SpreadsheetML Basics”, from Microsoft, provides a good overview. It is a 30-page presentation including diagrams, and it is not practical to include its contents here. Four different stackoverflow reviewers have jumped on this post to delete it because the stackoverflow policy objects to simple links. I do not think that is … Read more

Python convert csv to xlsx

Here’s an example using xlsxwriter: import os import glob import csv from xlsxwriter.workbook import Workbook for csvfile in glob.glob(os.path.join(‘.’, ‘*.csv’)): workbook = Workbook(csvfile[:-4] + ‘.xlsx’) worksheet = workbook.add_worksheet() with open(csvfile, ‘rt’, encoding=’utf8′) as f: reader = csv.reader(f) for r, row in enumerate(reader): for c, col in enumerate(row): worksheet.write(r, c, col) workbook.close() FYI, there is also … Read more

Importing a big xlsx file into R?

I stumbled on this question when someone sent me (yet another) Excel file to analyze. This one isn’t even that big but for whatever reason I was running into a similar error: java.lang.OutOfMemoryError: GC overhead limit exceeded Based on comment by @DirkEddelbuettel in a previous answer I installed the openxlsx package (http://cran.r-project.org/web/packages/openxlsx/). and then ran: … Read more

Handling java.lang.OutOfMemoryError when writing to Excel from R

This is a known issue: http://code.google.com/p/rexcel/issues/detail?id=33 While unresolved, the issue page links to a solution by Gabor Grothendieck suggesting that the heap size should be increased by setting the java.parameters option before the rJava package is loaded. (rJava is a dependency of xlsx.) options(java.parameters = “-Xmx1000m”) The value 1000 is the number of megabytes of … Read more

Importing Excel files into R, xlsx or xls

For a solution that is free of fiddly external dependencies*, there is now readxl: The readxl package makes it easy to get data out of Excel and into R. Compared to many of the existing packages (e.g. gdata, xlsx, xlsReadWrite) readxl has no external dependencies so it’s easy to install and use on all operating … Read more

Easy way to export multiple data.frame to multiple Excel worksheets

You can write to multiple sheets with the xlsx package. You just need to use a different sheetName for each data frame and you need to add append=TRUE: library(xlsx) write.xlsx(dataframe1, file=”filename.xlsx”, sheetName=”sheet1″, row.names=FALSE) write.xlsx(dataframe2, file=”filename.xlsx”, sheetName=”sheet2″, append=TRUE, row.names=FALSE) Another option, one that gives you more control over formatting and where the data frame is placed, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)