title | description | author | ms.author | ms.date | ms.service | ms.subservice | ms.topic | helpviewer_keywords | |||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Importing Data into Microsoft Excel from a Visual FoxPro Database |
Importing Data into Microsoft Excel from a Visual FoxPro Database |
David-Engel |
v-davidengel |
01/19/2017 |
sql |
connectivity |
conceptual |
|
Importing Data into Microsoft Excel from a Visual FoxPro Database
You can import Visual FoxPro data into your Microsoft Excel worksheet if you have defined a data source for it. For information about creating a Visual FoxPro data source, see Accessing a Visual FoxPro Data Source from Microsoft Excel.
To import Visual FoxPro data into an Microsoft Excel worksheet
-
Open a Microsoft Excel spreadsheet.
-
From the Data menu, choose Get External Data. Microsoft Query opens.
-
In the Select Data Source dialog box, select a Visual FoxPro data source and then click Use.
-
If the database accessed by your data source includes tables, select a table from the Add Tables dialog box. Microsoft Query displays the added table in the top half of the query designer.
[!NOTE]
The Owner list is not available in this dialog box because the driver does not support owners. The Database list is not available because the driver does not support multiple databases in a data source. -
Select fields for your query by dragging them from the table onto the lower half of the designer.
-
Close Microsoft Query. The data you selected is imported into your Microsoft Excel spreadsheet.
The ESF Database Migration Toolkit is a robust and efficient solution for migrating data between various database formats, including Foxpro and MS Excel.
This guide will show you how to easily migrate data from Foxpro to MS Excel through a few simple steps of a wizard, streamlining complex migration processes and saving you valuable time.
Software Required:
DMToolkit_x64.zip (60.9 MiB) |
64-bit Windows application for ESF Database Migration Toolkit 11.1.24 (2023-04-14). (md5: 20e0bca60d66442ae0435980e708e8c4) |
DMToolkit_win32.zip (57.4 MiB) |
32-bit Windows application for ESF Database Migration Toolkit 11.1.24 (2023-04-14). (md5: 680026ef8ecd5572eb4f0556d3f4abc2) |
System Supported:
- Windows 7 or higher.
- Foxpro 2.6 or higher.
- MS Excel 97 or higher.
Introduction:
1. In «Choose a Data Source» dialog, choose «Visual Foxpro Database (*.dbc) » or «FoxPro/dBase Free Table (*.dbf)» ;
2. In «Choose a Destination» dialog, Choose «Microsoft Excel(*.xls;*.xlsx)»;
- Click «…» button to select the Excel (.XLS or .XLSX) file.
3.In «Select source Tables(s) & View(s)» dialog;
- Select the tables or views you want to migrate.
- You can access the table options or adjust the table structure by clicking the «…» button.
- In the «Field Mapping» option, you can customize the destination table’s fields, such as field name, data type, default value, comment, and more. You also have the option to choose the data transfer method, including Overwrite Table, Empty Data, Append Data, or Skip Table, or even filter the data before transferring it.
4. In «Execution» Dialog;
- You can start the migration process by clicking «Submit». The toolkit will efficiently and seamlessly migrate your data from Foxpro to MS Excel without the need for manual intervention.
- To keep track of the migration process, you can access the full migration log by clicking «Browse Log». This will provide you with a comprehensive view of the entire migration, including any potential issues and their resolutions.
- To save time in the future, you can save the migration settings as a job file by clicking «Save as job». This allows you to quickly reload the migration job at a later time or run the migration job using the command-prompt by typing «dmtc.exe —help». The command-prompt provides you with a full list of parameters to customize the migration process to your specific needs.
5.Finished!
Upon completion, the toolkit will generate a comprehensive migration report, providing you with all the information you need to verify the accuracy and completeness of the migration process. So, you can sit back and relax while the program carries out the task efficiently. Should you have any inquiries or recommendations, don’t hesitate to reach out to us. We’re always happy to help.
Download Now »
Related Links:
- Remove From My Forums
-
Question
-
I work for the NS Provincial Government and currently use Visual FoxPro 9.
Going forward, our Help Desk will no longer be supporting this program. We are also shifting to new software for our Correspondence Tracking System (CTS).
My question is: How do I transfer data from FoxPro to a useable (searchable) program like Excel or Word.
When I open the program, there are no features referring to exporting. The only thing that I can produce is a report of outstanding correspondence. I think that I need to know how to ‘get in through a back door’.
Can anyone help me?
Regards,
Joanne Bolger
Answers
-
Hi,
There is a command in Foxpro to copy data from VFP table to Excel file but it is having some limitations of MEMO field will not get transferred to excel file and limitation of records get exported to excel file (can export a maximum of 65,535 rows)
Extract from VFP 9 Help
COPY TO FileName [DATABASE DatabaseName [NAME
LongTableName]] [FIELDS FieldList | FIELDS LIKE Skeleton | FIELDS EXCEPT
Skeleton] [Scope] [FOR lExpression1] [WHILE
lExpression2] [ [WITH] CDX ] | [ [WITH] PRODUCTION ] [NOOPTIMIZE] [ [TYPE] [ FOXPLUS | FOX2X | DIF | MOD | SDF | SYLK | WK1 | WKS | WR1 | WRK | CSV | XLS | XL5 | DELIMITED [ WITH
Delimiter | WITH BLANK | WITH TAB | WITH CHARACTER Delimiter
] ] ] [AS nCodePage]It is better to go for customized package to export it to Excel.
— If you want to Only view/Search the data you can use Foxpro itself or application like DBFVIEWER
— You can also migrate VFP data to different database like MS-SQL, MYSQL, Postgres so that you can query data.
-
Marked as answer by
Wednesday, July 31, 2019 6:12 AM
-
Marked as answer by
-
Hi,
There is a command in Foxpro to copy data from VFP table to Excel file but it is having some limitations of MEMO field will not get transferred to excel file and limitation of records get exported to excel file (can export a maximum of 65,535 rows)
The limitation will depend of the Excel version you have installed
Each version have a maximum lines per sheet, and that will determine the maximum lines to be exported
You can always export it as CSV with no maximum lines limited and open it from Excel
-
Marked as answer by
Tom BorgmannEditor
Wednesday, July 31, 2019 6:12 AM
-
Marked as answer by
-
Since your actual need isn’t to get Excel files but the data, a Foxpro Application will either store it’s data in separate DBF (table) data files.
Unless these tables are encrypted you have all data in these files and access to it just needs Foxpro or at least the VFP OLEDB Provider and programming skills. Not exports and surely not exports to formats really bad for data transfer.
You’re talking of corrrespondence tracking and it seems to me all you really need to transfer are
a) current correspondence to be able to continue it until some final stage
b) old correspondence only for reference.
I second Tamar, it’s a data migration job to transfer this data to a target system and that’ll require knowledge about the structuring of the data in the old and new system and translation of the data in terms of transformation. Even the same topic and domain
of data like shop order/sales can be stored in gazillian of different ways and database of system A can have table structures storing aspects of the data System B has not foreseen, so you caould have a loss of details.The usual strategy is to cover a) by finishing such correspondence with the old system, then b) isn’t even necessarily moving any data into the format of a new system but you just keep it in some searchable form. Even if t’s a requirement to purge VFP and
VFP runtimes from your systems as laws or regulations demand that, you’d be better off with at least a 1:1 transferring of the data as it’s strucutred now into a MSSQL backend or whatever is allowed database server and have a query tool to get at whatever
back reference you need.In very short summary you’re likely having no idea what relational databases are and how data is stored in a relational way and normalized structure and that it doesn’t simply translate to one major list, even if the old VFP system mainly displayed a list
of correspondence to you.To illustrate that with eg mails of a mail client, which really is mainly just a list of the mail texts with all its attributes from sender to recipient, subject, date, etc. Several mails will belong to one «conversation» related by being replies
to each other. That kind of links are not really covered by an Excel sheet. So think twice before you go such a route of export of data in inferior formats not capable to give you even such simple features as grouping mails belonging to the same conversation.Bye, Olaf.
-
Edited by
OlafDoschke
Wednesday, May 15, 2019 5:35 AM -
Marked as answer by
Tom BorgmannEditor
Wednesday, July 31, 2019 6:14 AM
-
Edited by
-
Your screenshot dowsn’t show, it’s complicated to get the feature to post images here in this forum.
But from what you describe this isn’t FoxPro, it’s likely just an application written in FoxPro and of course that doesn’t give you all the options the development environment and the language has.
The developer of that application might nocht even have changed the main window title bar caption from «Microsoft Visual Foxpro» to somthing ekse like the application title and therefore you think this is FoxPro.
Let me show how the FoxPro environment looks like:
And this is just the bare minimum with VFP system menu, standard toolbar, command window (to immediately execute commands) and no project file open and none of the several tool windows you find in the menu and toolbar or other toolbars not added, as they
only are necessary while designing forms or classes or reports, etc. etc. VFP transforms it’s menu and toolbars depending on what you do, but even the bare minium is more than you describe and has nothing sepcialised such as letters.So if your window only has the menu items you tell, that’s not FoxPro.
What you likely will have is a folder with data, DBF files for sure — and as your menu items allow reindex, pack and especially pack memo — also CDX (index) and FPT (memo files). These three will come in bundles and are your data files.
It’s not straight forward to get at this data without Foxpro itself, but maybe what you start is indeed VFP, but just by configuration starting a _startup program, which replaces the system menu with the application menu.
Do you have an executable named VFPN.EXE where N might be any digit from 3 to 9? (It should be 9, when you say it is VFP9, but as you see the standard development environment of VFP doesn’t tell the version number)
If so, you might get far more out of this, because quite likely someone who doesn’t even set the screen caption also doesn’t know how to build an EXE and a setup and just installs VFP itself with his programs and forms for simplicity, as he manages to start
that like he does during development. That’d be against the end user license of VFP, but not your fault.So tell us, the name of the EXE you start, you likely have a Windows start menu item or a shortcut. Instead of double clicking it, click on it with the right mouse key and find (depending on what) properties or an option to open the folder with the application.
That’ll tell us more about what you really have there,Bye, Olaf.
PS: last not least: If you don’t have VFP itself, you still can get at the data itself because things like the VFP OLEDB provider are free to get and can be used to query data. It doesn’t work standalone, it at least needs a script written in some language,
but even without any programming environment installed, you have powershell to run something, for example. It’s too early to hand out some code before we know what you really have.-
Edited by
OlafDoschke
Monday, May 27, 2019 10:18 AM -
Marked as answer by
Tom BorgmannEditor
Wednesday, July 31, 2019 6:13 AM
-
Edited by
-
It seems to me that whoever is implementing your new system should have the responsibility for transferring your existing data to it. Have you asked them to do so?
Tamar
-
Proposed as answer by
Koen-P
Wednesday, May 15, 2019 11:39 AM -
Marked as answer by
Tom BorgmannEditor
Wednesday, July 31, 2019 6:11 AM
-
Proposed as answer by
Let’s imagine we want to convert the Visual FoxPro 9.0 sample DBF files provided by Microsoft.
The database directory contains the database container files (northwind.dbc, northwind.dct, northwind.dcx)
and a number of table files. For example the table categories has the files categories.dbf, categories.cdx and
categories.fpt, while the table customers has only the files customers.dbf and customers.cdx.
In any case, we have to upload the database container files. In addition to that, we also have to upload
the files of the tables that we want to convert. Let’s assume we only want to convert the categories table,
the command would look like this:
curl -F files[]=@northwind.dbc -F files[]=@northwind.dct -F files[]=@northwind.dcx -F files[]=@categories.dbf -F files[]=@categories.cdx -F files[]=@categories.fpt 'https://www.rebasedata.com/api/v1/convert?outputFormat=xlsx&errorResponse=zip' -o output.zip
The file output.zip will contain a Excel file, one for each table in the set of input files. If something went wrong, output.zip contains the error message.
Sometimes users, who are using MS Visual FoxPro, need to import their Visual FoxPro database and tables in Microsoft Office applications, such as: Microsoft Excel or Word. But don’t know how? Most of the time users take help of a 3rd party converter tool that can perform conversion of DBF files into Word document or Excel worksheet format. As they are not aware of an easy manual trick, they have to use such a paid tool.
But the manual trick doesn’t require any third-party tool or any other application to perform the operation. By using Microsoft Visual FoxPro OLE DB Provider, the manual trick can be executed with ease.
First of all, you need to connect your Visual FoxPro database in Microsoft Excel or Word. Learn how to do that?
In Microsoft Excel, follow the steps given below:
Step 1: Launch Microsoft Excel on your system.
Step 2: From the Data menu, point to Import External Data, and click Import Data.
Step 3: In the Select Data Source dialog box, click New Source Data Connection.
Step 4: In the Data Connection Wizard, select Other/Advanced.
Step 5: In the Provider tab, select Microsoft OLE DB Provider for Visual FoxPro.
The Connection tab in the Data Link Properties dialog box will be appeared.
In Microsoft Word, follow the steps given below:
Step 1: Launch Microsoft Word on your system.
Step 2: From the View menu, point to Toolbars, and click Database.
Step 3: On the Database toolbar, click the Insert Database icon.
Step 4: In the Database dialog box, click Get Data.
Step 5: In the Select Data Source dialog box, click New Source Data Connection.
Step 6: In the Data Connection Wizard, select Other/Advanced.
Step 7: In the Provider tab, select Microsoft OLE DB Provider for Visual FoxPro.
The Connection tab in the Data Link Properties dialog box will be appeared.
To add a Visual FoxPro database or table folder, follow the steps given below:
Step 1: On the Connection tab and in the Select or enter a database name box, type path and name of the database or table folder you want.
-or-
Step 2: To browse for a Visual FoxPro database or table folder, click the ellipsis (…) button to the right of the Select or enter a database name box to open the Configure Connection dialog box.
Step 3: Specify a different collating sequence if desired.
Step 4: To test the connection, click Test Connection. If connection is successful, click OK.
Database users might be interested in various other topics on Database Recovery & Management.
Содержание
- Convert Visual FoxPro database to Excel online
- Input file
- Output file
- Conversion methods
- How long does it take?
- COPY TO excel Sheet in foxpro
- 3 Answers 3
- Visual foxpro dbf to excel
- Answered by:
- Question
- Answers
- All replies
- Migrating data from Foxpro to Excel(*.xls; *.xlsx)
- Software Required:
- System Supported:
- Introduction:
- 1. In «Choose a Data Source» dialog, choose «Visual Foxpro Database (*.dbc) » or «FoxPro/dBase Free Table (*.dbf)» ;
- 2. In «Choose a Destination» dialog, Choose «Microsoft Excel(*.xls;*.xlsx)»;
- 3.In «Select source Tables(s) & View(s)» dialog;
- 4. In «Execution» Dialog;
- 5.Finished!
- COPY TO excel Sheet in foxpro
- 3 Answers 3
Convert Visual FoxPro database to Excel online
Uploading and converting your file..
Do you have problems using the web upload?
Register and try the Amazon S3 upload!
Input file
Please upload the database files. In can be a single file, for example table.dbf, or multiple files.
In the case of Visual FoxPro, you need to upload the table files (.DBF, .CDX, .FPT) and optionally the database container files (.DBC, .DCT, .DCX).
Max file size for web uploads: 50 GB
Register to upload big files via Amazon S3.
Output file
The API will return a ZIP archive of .XLSX files, one for each table in the set of input files. Since Excel has a limit of about one million rows, it could be that the rows are divided into several files.
Conversion methods
Download the RebaseData client Java tool . To convert your database using RebaseData, run the following command:
Let’s imagine we want to convert the Visual FoxPro 9.0 sample DBF files provided by Microsoft. The database directory contains the database container files (northwind.dbc, northwind.dct, northwind.dcx) and a number of table files. For example the table categories has the files categories.dbf, categories.cdx and categories.fpt, while the table customers has only the files customers.dbf and customers.cdx. In any case, we have to upload the database container files. In addition to that, we also have to upload the files of the tables that we want to convert. Let’s assume we only want to convert the categories table, the command would look like this:
The file output.zip will contain a Excel file, one for each table in the set of input files. If something went wrong, output.zip contains the error message.
How long does it take?
The conversion process takes between 15 seconds and multiple minutes. It depends on the size of the database.
Источник
COPY TO excel Sheet in foxpro
Is their any command in Foxpro that convert the DBF into a particular excel sheet. I have three DBF(dbf_1, dbf_2, dbf_3). My current program convert the file using copy to «filename.xls» type fox2x and then I will manually copy the consolidate all the sheet into one excel. For me, this method I using is alright but what if their are 20 or more dbf that I will consolidate. Is their any command in foxpro that convert the dbf’s into one excel file. I already use the foxpro Automation but it is to slow.
3 Answers 3
Also «copy to . type fox2x». although better than many other type selections (such as csv and xls) should not be chosen when there are better ways.
You are saying automation is slow, but don’t know if you are really finding automation slow, or if you have tried it in the ways that you shouldn’t use to transfer data to Excel. The sample below, use one of the variations of my «vfp2excel» function and automation. It transfers sample Customer, Employee, Orders, OrdItems and Products data in 2.5 seconds on my machine. If you really meant it as slow then no dice, otherwise here is the sample:
This is what I was looking for 🙂 I was trying with my knowledge of Excel Automation programming in Visual FoxPro but always got errors. My task was to create «n» Sheets from one big cursors which I want to parse regarding customer selection of attribute name from cursor to get also «n» Sheets. This sample is for 3 cursors and 3 Sheets and it is generic. But I need this for «n» cursors and one attribute which customer select to distinct and get «n» Sheets in one Excel file. So now I have dynamic procedure. I customized this code and solve my problem which I am trying to end for about 4 days. So again thank you for this code and off course I will not modify VFP2Excel procedure and wrote somewhere else my name. Thanks for help !
There is no native VFP function to do this, BUT, there is an awesome open source project which has a class that will make this very easy:
VFPx Workbook Xlsx — See it here on Github: XLSX Workbook for FoxPro
It has 3 magical functions that will do exactly what you asked for:
- CreateWorkbook()
- AddSheet()
- SaveTableToWorkbook()
(Repeat commands 2 and 3 above for each DBF/Sheet you want to create)
It is well documented with a 54-page PDF and code sample that explains everything you’ll need to know.
Источник
Visual foxpro dbf to excel
This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.
Answered by:
Question
Using VFP, it is possible to create Excel 2003(.xls) files from a dbf file. (Using the COPY TO command). But it does not support latest versions. i.e .xlsx file. So is there any way to create a .xlsx file from a dbf file using VFP? If not is it possible to convert created xls file to xlsx format using VFP?
Answers
Probably the easiest solution for you is to save it to an (ordinary) .xls file. Open Excel and than save is as .XLSX.
If you have an Excel version greater than 2003 on your machine
1)
Do a COPY TO . will create the XLS extension
2)
** NOTE: lc_file is just the file name, do not contain extension **
oExcel = CREATEOBJECT(«Excel.Application»)
oWorkbook = oExcel.Application.Workbooks.Open(lc_file)
oWorkbook.SaveAs(lc_file) && Will convert to the current Excel version extension
some time ago Craig Boyd offered some code to read/write xlsx files with VFP:
Gruss / Best regards
-Tom
Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible,
you are, by definition, not smart enough to debug it. 010101100100011001010000011110000101001001101111011000110110101101110011
If you have an Excel version greater than 2003 on your machine
1)
Do a COPY TO . will create the XLS extension
2)
** NOTE: lc_file is just the file name, do not contain extension **
oExcel = CREATEOBJECT(«Excel.Application»)
oWorkbook = oExcel.Application.Workbooks.Open(lc_file)
oWorkbook.SaveAs(lc_file) && Will convert to the current Excel version extension
some time ago Craig Boyd offered some code to read/write xlsx files with VFP:
Gruss / Best regards
-Tom
Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible,
you are, by definition, not smart enough to debug it. 010101100100011001010000011110000101001001101111011000110110101101110011
Probably the easiest solution for you is to save it to an (ordinary) .xls file. Open Excel and than save is as .XLSX.
Sorry, could not get this to work.
had program error.
» OLE IDispatch exception code 0 from Microsoft Excel: ‘filenae.xlsx’ could not be found. Check the spelling of the file name, verify that the file location is correct.
If you are trying to open the file from your list of most recently used files, make sure that the file has not been renamed, moved, or deleted. «
Would appreciate more clarity.
— Gabriel Oladoyinbo Senior Consultant http://topmarkservices.net
Because you obviously only provided a file name without path. Excel has no connection to the VFP process and its current working directory.
If you want to use Bennys idea of COPY TO TYPE XLS and then convert XLS to XLSX by excel loading and savnig the file, you need a file name with full path but without file extension.
For example as in
This first creates a copy of the cursor crstest (which could alo be your dbf or anything else) to the file tempexcel.XLS within the temp directory and then loads and saves as tempexcel.XLSX (with excel version 2007 or later XLSX is the default file type).
The essential ingredients are, as Benny already commented: NO file extension (to get XLS/XLSX automatic) and on the other side FULL PATH.
Maybe you even didn’t do the COPY TO Benny provided, then Excel can’t open a non existing XLS file to convert it to XLSX at all, of course.
Источник
Migrating data from Foxpro to Excel(*.xls; *.xlsx)
The ESF Database Migration Toolkit is a robust and efficient solution for migrating data between various database formats, including Foxpro and MS Excel.
This guide will show you how to easily migrate data from Foxpro to MS Excel through a few simple steps of a wizard, streamlining complex migration processes and saving you valuable time.
Software Required:
DMToolkit_x64.zip (60.9 MiB) |
64-bit Windows application for ESF Database Migration Toolkit 11.1.14 (2023-03-16). (md5: 1826bf3861a90a3705a9fa92c9a89538) |
DMToolkit_win32.zip (57.4 MiB) |
32-bit Windows application for ESF Database Migration Toolkit 11.1.14 (2023-03-16). (md5: a3082fc2f98007fabb6758837640f9b3) |
System Supported:
- Windows 7 or higher.
- Foxpro 2.6 or higher.
- MS Excel 97 or higher.
Introduction:
1. In «Choose a Data Source» dialog, choose «Visual Foxpro Database (*.dbc) » or «FoxPro/dBase Free Table (*.dbf)» ;
2. In «Choose a Destination» dialog, Choose «Microsoft Excel(*.xls;*.xlsx)»;
- Click «. » button to select the Excel (.XLS or .XLSX) file.
3.In «Select source Tables(s) & View(s)» dialog;
- Select the tables or views you want to migrate.
- You can access the table options or adjust the table structure by clicking the «. » button.
- In the «Field Mapping» option, you can customize the destination table’s fields, such as field name, data type, default value, comment, and more. You also have the option to choose the data transfer method, including Overwrite Table, Empty Data, Append Data, or Skip Table, or even filter the data before transferring it.
4. In «Execution» Dialog;
- You can start the migration process by clicking «Submit». The toolkit will efficiently and seamlessly migrate your data from Foxpro to MS Excel without the need for manual intervention.
- To keep track of the migration process, you can access the full migration log by clicking «Browse Log». This will provide you with a comprehensive view of the entire migration, including any potential issues and their resolutions.
- To save time in the future, you can save the migration settings as a job file by clicking «Save as job». This allows you to quickly reload the migration job at a later time or run the migration job using the command-prompt by typing «dmtc.exe —help». The command-prompt provides you with a full list of parameters to customize the migration process to your specific needs.
5.Finished!
Upon completion, the toolkit will generate a comprehensive migration report, providing you with all the information you need to verify the accuracy and completeness of the migration process. So, you can sit back and relax while the program carries out the task efficiently. Should you have any inquiries or recommendations, don’t hesitate to reach out to us. We’re always happy to help.
Источник
COPY TO excel Sheet in foxpro
Is their any command in Foxpro that convert the DBF into a particular excel sheet. I have three DBF(dbf_1, dbf_2, dbf_3). My current program convert the file using copy to «filename.xls» type fox2x and then I will manually copy the consolidate all the sheet into one excel. For me, this method I using is alright but what if their are 20 or more dbf that I will consolidate. Is their any command in foxpro that convert the dbf’s into one excel file. I already use the foxpro Automation but it is to slow.
3 Answers 3
Also «copy to . type fox2x». although better than many other type selections (such as csv and xls) should not be chosen when there are better ways.
You are saying automation is slow, but don’t know if you are really finding automation slow, or if you have tried it in the ways that you shouldn’t use to transfer data to Excel. The sample below, use one of the variations of my «vfp2excel» function and automation. It transfers sample Customer, Employee, Orders, OrdItems and Products data in 2.5 seconds on my machine. If you really meant it as slow then no dice, otherwise here is the sample:
This is what I was looking for 🙂 I was trying with my knowledge of Excel Automation programming in Visual FoxPro but always got errors. My task was to create «n» Sheets from one big cursors which I want to parse regarding customer selection of attribute name from cursor to get also «n» Sheets. This sample is for 3 cursors and 3 Sheets and it is generic. But I need this for «n» cursors and one attribute which customer select to distinct and get «n» Sheets in one Excel file. So now I have dynamic procedure. I customized this code and solve my problem which I am trying to end for about 4 days. So again thank you for this code and off course I will not modify VFP2Excel procedure and wrote somewhere else my name. Thanks for help !
There is no native VFP function to do this, BUT, there is an awesome open source project which has a class that will make this very easy:
VFPx Workbook Xlsx — See it here on Github: XLSX Workbook for FoxPro
It has 3 magical functions that will do exactly what you asked for:
- CreateWorkbook()
- AddSheet()
- SaveTableToWorkbook()
(Repeat commands 2 and 3 above for each DBF/Sheet you want to create)
It is well documented with a 54-page PDF and code sample that explains everything you’ll need to know.
Источник