Category Archives: Excel

Reference a range using column number

Questions: I’m looking for something rather simple, but I’ve been trying to do it for quite some time now. I need to get values from a column. Lets say I have several columns with headers and I need to pull data from a column with a specific header. I can easily get it’s number by… Read More »

Varying OleDb performance?

Questions: I’m currently trying to use OleDb/JET to export SQL Server data to an Excel 2003 file. I initially coded the export in a console application, and it worked fast enough. However, running the same code during an ASP.Net request takes roughly three times longer. Specifically, it’s slowing down during a call to OleDbCommand.ExecuteQuery, which… Read More »

How to add a menu item to Excel 2010 Cell Context Menu – old code doesn't work

Questions: I’ve tried 3 different code samples and they all fail. Here’s the code from a MSFT employee (How to show a context menu on a range), the other two samples have pretty much the exact same code: private void ThisAddIn_Startup(object sender, System.EventArgs e) { CommandBar cellbar = this.Application.CommandBars[“Cell”]; CommandBarButton button = (CommandBarButton) cellbar.FindControl(MsoControlType.msoControlButton, 0,… Read More »

AttributeError: 'Sheet' object has no attribute 'write'

Questions: I am trying to write a string in a cell within an excel file. My code is import xlwt import xlrd workbook = xlrd.open_workbook(‘my_workbook.xls’) worksheet = workbook.sheet_by_index(0) worksheet.write(0,2,”string”) While I was looking for a solution I leardned that it could be becouse my xlwt library has an old version. However when I checkied it… Read More »

Adding an image from memory stream to Excel document

Questions: I have an image in a memory stream and I want to write this to an MS Excel document, the PIA only exposes the AddPicture method which takes a file path. Is there away to add a picture without having to write the image to disc? MSDN http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.shapes.addpicture(v=office.14).aspx Answers: Well, a bit of blind… Read More »

Apache Poi 3.13 can't find classes to open XLSX files

Questions: I am using apache POI to read and write Excels’ files with Java, but I am not able to find WorkbookFactory nor XSSFWorkbook in the sources to read xlsx files. pom.xml : <poi.version>3.13</poi.version> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>${poi.version}</version> </dependency> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml</artifactId> <version>${poi.version}</version> </dependency> I can’t find neither any information in the changelog of apache… Read More »

Download Excel in Backbone.js

Questions: //Download SKU logic downloadSku: function (e) { e.preventDefault(); var checkedValues = this.$el.find(‘.chk:checked’).map(function () { return this.value; }).get(); var options = { success: function (model, response) { console.log(response); var blob = new Blob([response], { type: ‘application/vnd.ms-excel’ }); var downloadUrl = URL.createObjectURL(blob); var a = document.createElement(“a”); a.href = downloadUrl; a.download = “downloadFile.xlsx”; document.body.appendChild(a); a.click(); } };… Read More »