Exporting data from MV to Excel
- Create a CSV or other Tab-Delimited file. When a .csv file is opened with Excel you'll get a basic set of columns and rows.
- Use the AccuTerm FTD utility to import and export with .xls files. AccuTerm also has samples to use Excel formulas to access MV. See
- NebulaXLite allows creation of rich documents from BASIC, compared to plain data in cells.
- Since Office 2003, Excel has supported so-called XML Spreadsheets, using a schema known as SpreadsheetML - this is a simple approach that has the advantage of creating a single file, in a manageable format. There are a couple of downsides: 1) If you name the file .xml it opens in IE, but if you name it .xls it opens in Excel with a warning that may be alarming. 2) If you are exporting thousands of rows with dozens of columns, the resulting files can get quite large. Still, for modest needs this is an easy approach. SCI.XLS.RECALL has an example of a program that takes a delimited text file and converts it to an XML document suitable for loading into Excel.
- Since Office 2010, the internal format used for Office documents has switched to a zipped collection of XML files. Since these are "just" text files, it's reasonable to attempt to produce them directly from a PICK Basic program, and this is certainly feasible. Trying to reverse-engineer the xlsx XML schema can be challenging - Excel throws everything and the kitchen sink into the zip file, and small errors lead to Excel rejecting the entire file. Polymath Programmer has some excellent resources to explain what's going on at just the right level of detail. Well worth buying the book, and the free code if you're using DotNet. SCI.XLSX.RECALL has an example of a more complicated program that takes a delimited file and turns it into a zipped collection of XML documents that can be open natively in Excel.
Importing data from Excel to MV
- As above, see AccuTerm.
- See this blog entry for discussion of a possible future product as well as code to integrate Excel with MV via a web service: Search the blog for notes about integration with Microsoft Office applications like Outlook.
Direct Connectivity vs import/export
This can be accomplished with any connectivity code and Microsoft Office add-ins. Look into Microsoft VSTO (Visual Studio Tools for Office) to create the Excel integration piece. Other methods can be used such as XLAs or VBA macros. Excel development is a field unto itself. Use tools like UniObjects.NET, mv.NET, or ON.NET to do the actual connectivity directly into MV. For clients outside of the intranet, create the add-in with a web service interface and connect into any MV platform using standard web service methods. (TG)
There are various solutions on this site for converting Excel to CSV and parsing CSV to dynamic or dimensioned arrays.
Tags: excel csv spreadsheets