excel

Multi-column sort with VBA

I'm using VBA to sort columns in Excel 2003. I need to sort by column 5 ascending, then column 3 using a custom order, then by column 4 ascending. I'm having difficulty getting the sort to work and I don't totally understand how OrderCustom applies. Any pointers in the right direction would be appreciated :) My code is below. With wsDa...

preserve empty cells when saving excel as xml

Hello, I have an excel document where some of the cells are empty When i save the excel as xml spreadcheet i get the row with only the cells that have data and and the empty cells disapear (and the following cell gets an index attribute to indicate his true position) Is there a way to save the excel in xml and have the empty cells apear...

How do I create a loop in Access VBA/SQL to select records and output to Excel?

Hello, I need some help on writing some VBA/SQL code into a module in Access, which should do the following: Loop through Table 'Schools', with just one field (SchoolName). Use each value in the first table to select records from Table 'ChildData', with several fields about individual children, including which school they attend (Scho...

Excel 2007 is locked when used as a datasource for Word Mail Merge

When using Word 2007 MailMerge with an Excel 2007 (xlsx) as a datasource, the .XLSX file is locked and cannot even be copied using Windows Explorer. It is possible to connect to the Excel file as a datasource (using Visual Studio 2008 and .NET 3.5) but it is not possible to use the Office automation or similar third party components. We...

Where should I place code which generates Excel spreadsheet?

I am using spreadsheet gem to generate native Excel file. This is not CSV, XML file. Ordinary Ruby code is used to create the file. The generated Excel file (kept in StringIO) is forwarded to a client using send_data method. I need send_data method because of its parameters like disposition. The data for the Excel is retrieved in contro...

Clone existing recordset to excel recordset

I have a recordset that contains all of the data needed to import into an Excel file. Is there a way I can clone my live recordset into the one created when I open an Excel file? Here is what I'm trying right now with no luck. Dim connection : Set connection = Server.CreateObject("ADODB.Connection") connection.Open "Driver={Microsoft ...

JXL and Apache POI parsing excel with attached image objects

I have tried using JXL and Apache POI to load data from an excel file, up until now the JXL mechanism has worked fine. Even if I embed an images in the file. I received a file from a source which wont parse, I get the following exception with POI Exception in thread "main" org.apache.poi.hssf.record.RecordInputStream$LeftoverDataExcep...

ActiveDocument.MailMerge with DDE leaves excel open

How to close excel opened by Word mail merge macro? With ActiveDocument.MailMerge .MainDocumentType = wdCatalog Connection:="Entire spreadsheet", SubType:=8, ReadOnly:=True .Destination = wdSendToNewDocument .Execute End With 'Activedocument DDETerminateAll ...

jExcelApi - cell date format reusing doesn't work.

I created a wrapper to jExcelApi classes to easily export lists of objects to Excel. To minimize object creation cell formats are created as static fields and reused in consecutive calls to export. But I have problems with Date format - the first call works good, but in all consecutive exports date cells have numeric format instead of da...

Diagnosing an OLEDB exception when Quering Excel 2010

To query an excel sheet via SQL, I used to use either: Dim excelConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strPath + ";Extended Properties=""Excel 8.0;IMEX=1;HDR=YES;""" or Dim excelConnectionString As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source= " + strPath + ";Extended Properties=""Ex...

ASP.NET OleDb Excel Connection to Worksheet

I have an Excel file that the customer is pulling from their financial software and uploading to my web app. I need to connect to the file through ADO and read its contents into a SQL database. The problem is that the file that comes from the financial software is a standalone Excel Worksheet, not Workbook, so no piece of software (b...

Excel 2007 - Sheets.add from template file loses formatting

I have a template in Excel 2003 that copies in template sheets as needed. We are about to upgrade to Excel 2007, and I have found that when the sheets are added as in the past: Sheets.Add Type:="Z:\Investments.xltm" The buttons on the sheet move around and it drops random cells formatting. I am wondering if anyone else has encounter...

How to Highlight Row in XSL file without Opening EXCEL using C#

Hi, I have an XSL file that I am generating from CSV from and Object etc. etc. Everything is done except that I need to highlight particular rows in the xsl file. I don't want to have to open Excel and use Macros. Is there a way to do this in C#? ...

Filehelpers ExcelStorage.ExtractRecords fails when first cell is empty

Hello, When the first cell of an excel sheet to import using ExcelStorage.ExtractRecords is empty, the process fail. Ie. If the data starts at col 1, row 2, if the cell (2,1) has an empty value, the method fails. Does anybody know how to work-around this? I've tried adding a FieldNullValue attribute to the mapping class with no luck. ...

Loop through each row of a range in Excel

This is one of those things that I'm sure there's a built-in function for (and I may well have been told it in the past), but I'm scratching my head to remember it. How do I loop through each row of a multi-column range using Excel VBA? All the tutorials I've been searching up seem only to mention working through a one-dimensional ran...

What is the best way of generating a xslx file on a web site? Possibly with millions of rows?

I'm tasked with writing a solution for fixing a poorly performing legacy excel file generator. The files I need to generate could get very large. Maybe up to a million rows with 40-50 columns. I guess I will stream directly to the user if possible, but I might just have to save the file to disk first and then create a link for the use...

Pivot table Values are now screwy

In Excel 2003, I have a macro that accidentally tried selecting a page field item (New York) that didn't exist. This renamed the currently selected page field (Alabama) to the value I tried to select (New York). I now have 3 or 4 values that are now wrong. Is there a way to refresh these pivot table values to the correct values without ...

Excel IQY file - Usage Option question

I have a simple Excel IQY file in which the contents look like this: WEB 1 http://somesite.html Selection=EntirePage Formatting=None PreFormattedTextToColumns=True ConsecutiveDelimitersAsOne=True SingleBlockTextImport=False DisableDateRecognition=False DisableRedirections=False This is simple, no problems. What I need to do is add o...

C# Accessing Excel Worksheet

Is this the correct way to access a MS Office Excel 2007 file? String connString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + file_path + ";Extended Properties=Excel 8.0;"; If so, how do I access a certain worksheet and insert rows? Links are also welcomed. ...

Character encoding issues when reading XLS files with PHP

I'm using the PHP-Excel-Reader library to read some XLS files and immediately have hit this issue: PHP Notice: iconv() [function.iconv]: Detected an incomplete multibyte character in input string in C:\web\docs\housing\excel_reader2.php on line 1718 The line in question is this: $result = iconv('UTF-16LE', $this->_defaultEncoding...