What is correct content-type for excel files? [duplicate]
For BIFF .xls files application/vnd.ms-excel For Excel2007 and above .xlsx files application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
For BIFF .xls files application/vnd.ms-excel For Excel2007 and above .xlsx files application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Here’s how I do it: private string GetExcelColumnName(int columnNumber) { string columnName = “”; while (columnNumber > 0) { int modulo = (columnNumber – 1) % 26; columnName = Convert.ToChar(‘A’ + modulo) + columnName; columnNumber = (columnNumber – modulo) / 26; } return columnName; }
Well, you need to install it. You’re looking for: The 2007 Office System Driver: Data Connectivity Components.
You can try this direct VBA approach which doesn’t require HEX editing. It will work for any files (*.xls, *.xlsm, *.xlam …). Tested and works on: Excel 2007 Excel 2010 Excel 2013 – 32 bit version Excel 2016 – 32 bit version Looking for 64 bit version? See this answer How it works I will … Read more
Alex is correct, but as you have to export to csv, you can give the users this advice when opening the csv files: Save the exported file as a csv Open Excel Import the data using Data–>Import External Data –> Import Data Select the file type of “csv” and browse to your file In the … Read more
I have found that putting an ‘=’ before the double quotes will accomplish what you want. It forces the data to be text. eg. =”2008-10-03″,=”more text” EDIT (according to other posts): because of the Excel 2007 bug noted by Jeffiekins one should use the solution proposed by Andrew: “=””2008-10-03″””
Some examples of how to avoid select Use Dim‘d variables Dim rng as Range Set the variable to the required range. There are many ways to refer to a single-cell range: Set rng = Range(“A1”) Set rng = Cells(1, 1) Set rng = Range(“NamedRange”) Or a multi-cell range: Set rng = Range(“A1:B10”) Set rng = … Read more
A simple workaround is to use Google Spreadsheet. Paste (values only if you have complex formulas) or import the sheet then download CSV. I just tried a few characters and it works rather well. NOTE: Google Sheets does have limitations when importing. See here. NOTE: Be careful of sensitive data with Google Sheets. EDIT: Another … Read more
Regular expressions are used for Pattern Matching. To use in Excel follow these steps: Step 1: Add VBA reference to “Microsoft VBScript Regular Expressions 5.5” Select “Developer” tab (I don’t have this tab what do I do?) Select “Visual Basic” icon from ‘Code’ ribbon section In “Microsoft Visual Basic for Applications” window select “Tools” from … Read more
Excel does not quit because your application is still holding references to COM objects. I guess you’re invoking at least one member of a COM object without assigning it to a variable. For me it was the excelApp.Worksheets object which I directly used without assigning it to a variable: Worksheet sheet = excelApp.Worksheets.Open(…); … Marshal.ReleaseComObject(sheet); … Read more