Questions tagged [excel]

Only for questions on programming against Excel objects or files, or complex formula development. You may combine the Excel tag with VBA, VSTO, C#, VB.NET, PowerShell, OLE automation, and other programming related tags and questions if applicable. General help regarding MS Excel for single worksheet functions is available at Super User.

Microsoft Office Excel is a spreadsheet application written and distributed by Microsoft for Microsoft Windows and macOS. It features calculation, graphing tools, sorting and filtering data, pivot tables and a macro programming language called Visual Basic for Applications (VBA).

Languages and environments for programming against Excel include:

Questions tagged with should be version-agnostic. More specific tags include:

Version-specific tags include , , , , , , , , and .

Microsoft Excel 2010 Microsoft Excel 2010 on Windows 7

More information

Useful resources

Official Logo

Microsoft Excel Official Logo

Logo Image Source: https://products.office.com/en-au/products

246392 questions
1995
votes
46 answers

How do I create an Excel (.XLS and .XLSX) file in C# without installing Microsoft Office?

How can I create an Excel spreadsheet with C# without requiring Excel to be installed on the machine that's running the code?
mistrmark
  • 4,349
  • 6
  • 20
  • 15
1121
votes
9 answers

What is a correct MIME type for .docx, .pptx, etc.?

For older *.doc documents, this was enough: header("Content-Type: application/msword"); What MIME type should I use for new .docx documents? Also, for pptx and xlsx documents?
Richard Knop
  • 73,317
  • 142
  • 374
  • 539
767
votes
42 answers

How do I properly clean up Excel interop objects?

I'm using the Excel interop in C# (ApplicationClass) and have placed the following code in my finally clause: while (System.Runtime.InteropServices.Marshal.ReleaseComObject(excelSheet) != 0) { } excelSheet =…
HAdes
  • 15,789
  • 18
  • 54
  • 74
655
votes
9 answers

How to use Regular Expressions (Regex) in Microsoft Excel both in-cell and loops

How can I use regular expressions in Excel and take advantage of Excel's powerful grid-like setup for data manipulation? In-cell function to return a matched pattern or replaced value in a string. Sub to loop through a column of data and extract…
Automate This
  • 28,343
  • 11
  • 54
  • 78
623
votes
36 answers

Excel to CSV with UTF8 encoding

I have an Excel file that has some Spanish characters (tildes, etc.) that I need to convert to a CSV file to use as an import file. However, when I do Save As CSV it mangles the "special" Spanish characters that aren't ASCII characters. It also…
Jeff Treuting
  • 13,352
  • 8
  • 33
  • 46
564
votes
16 answers

How to avoid using Select in Excel VBA

I've heard much about the understandable abhorrence of using .Select in Excel VBA, but I am unsure of how to avoid using it. I am finding that my code would be more re-usable if I were able to use variables instead of Select functions. However, I am…
BiGXERO
  • 6,324
  • 7
  • 20
  • 25
561
votes
35 answers

Stop Excel from automatically converting certain text values to dates

Does anyone happen to know if there is a token I can add to my csv for a certain field so Excel doesn't try to convert it to a date? I'm trying to write a .csv file from my application and one of the values happens to look enough like a date that…
user16324
520
votes
23 answers

Is there a way to crack the password on an Excel VBA Project?

I've been asked to update some Excel 2003 macros, but the VBA projects are password protected, and it seems there's a lack of documentation... no-one knows the passwords. Is there a way of removing or cracking the password on a VBA project?
Jonathan Sayce
  • 8,653
  • 4
  • 34
  • 47
516
votes
27 answers

Is it possible to force Excel recognize UTF-8 CSV files automatically?

I'm developing a part of an application that's responsible for exporting some data into CSV files. The application always uses UTF-8 because of its multilingual nature at all levels. But opening such CSV files (containing e.g. diacritics, cyrillic…
Lyubomyr Shaydariv
  • 18,039
  • 11
  • 53
  • 97
505
votes
36 answers

'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine

I'm trying to get data from an Excel file on a button click event. My connection string is: string connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\source\\SiteCore65\\Individual-Data.xls;Extended Properties=Excel 8.0;"; When I…
Shailesh Sahu
  • 5,171
  • 5
  • 15
  • 8
501
votes
3 answers

What is correct content-type for excel files?

I want excel files on a website to open in Excel when clicked, not get saved on desktop, or get opened embedded in a browser etc. Now obviously it all depends on how everything is configured for each user, but what's the best Content-Type and other…
taw
  • 16,697
  • 14
  • 52
  • 73
496
votes
56 answers

How to convert a column number (e.g. 127) into an Excel column (e.g. AA)

How do you convert a numerical number to an Excel column name in C# without using automation getting the value directly from Excel. Excel 2007 has a possible range of 1 to 16384, which is the number of columns that it supports. The resulting values…
robertkroll
  • 4,308
  • 6
  • 21
  • 23
381
votes
7 answers

Setting mime type for excel document

MS Excel has the following observed MIME types: application/vnd.ms-excel…
Subramanian
  • 4,892
  • 5
  • 23
  • 23
327
votes
12 answers

How to create strings containing double quotes in Excel formulas?

How can I construct the following string in an Excel formula: Maurice "The Rocket" Richard If I'm using single quotes, it's trivial = "Maurice 'The Rocket' Richard" but what about double quotes?
Allain Lalonde
  • 85,857
  • 67
  • 175
  • 234
322
votes
3 answers

Shortcut to Apply a Formula to an Entire Column in Excel

If I select a cell containing a formula, I know I can drag the little box in the right-hand corner downwards to apply the formula to more cells of the column. Unfortunately, I need to do this for 300,000 rows! Is there a shortcut, similar to…
John Shedletsky
  • 6,950
  • 10
  • 34
  • 57
1
2 3
99 100