- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have access to Compaq Visual Fortran (version 6.6a) and wish to write a code (in Fortran) that will enable me to read input data directly from cells in an Excel spread sheet. How do I do this?
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you have access to the f90SQL software (f90SQL is a Fortran-90 interface to the ODBC-API implemented in Windows) thing should be easy. Look at example at http://www.canaimasoft.com/f90SQL/Examples/Example4.htm. If not you will have to, I think, use COM interfaces to access Excel and get data.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The freeware version of f90SQL is included with CVF 6.5 and 6.6, and can be downloaded from Canaima Software's web site.
Steve
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think you'll have problems using SQL for direct access to Excel's cells. I think that your questions means that you want "read"/"write" data from/to 'i:j", so using SQL with Excel will be difficult. Use Automation and Compaq's tools for this purpose...
Vladimir V.Vasilchenko
Fortran Programmers Club
http://www.donpac.ru/usr/golub/fortran/
http://fortran-windows.tripod.com
Vladimir V.Vasilchenko
Fortran Programmers Club
http://www.donpac.ru/usr/golub/fortran/
http://fortran-windows.tripod.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For simple read/write operations, the ODBC way (using either the free or the Pro version of f90SQL) will work fine. Keep in mind, however, that ODBC sees your spreadsheet as another database table, so things like formatting, formulas, etc. are not available. Also the ODBC driver for excel has some limitation for writing (mainly it cannot delete spreadsheet rows). Still, using ODBC has advantages, it is fast and you don't need to have excel installed in the machine where your application is running.
The greatest level of flexibility and access can be achieved through the ActiveX/COM interface of excel (i.e. excel's automation interface). There are no limits here on what you can do with the spreadsheet. The main disadvantage is, however, that the machine where you Fortran application runs must also have excel installed, which may or may not be an issue in your case.
Our web site has examples of how to access excel spreadsheets using each of these paths. Check http://www.canaimasoft.com/f90sql/Examples/Examples.htm and http://www.canaimasoft.com/f90VB/Examples/Examples.htm (this last one uses another of our products called f90VB, which makes using ActiveX/COM from Fortran much easier than tapping into the direct Win-APIs).
Regards,
Marco Garcia
Canaima Software, Inc.
www.canaimasoft.com
The greatest level of flexibility and access can be achieved through the ActiveX/COM interface of excel (i.e. excel's automation interface). There are no limits here on what you can do with the spreadsheet. The main disadvantage is, however, that the machine where you Fortran application runs must also have excel installed, which may or may not be an issue in your case.
Our web site has examples of how to access excel spreadsheets using each of these paths. Check http://www.canaimasoft.com/f90sql/Examples/Examples.htm and http://www.canaimasoft.com/f90VB/Examples/Examples.htm (this last one uses another of our products called f90VB, which makes using ActiveX/COM from Fortran much easier than tapping into the direct Win-APIs).
Regards,
Marco Garcia
Canaima Software, Inc.
www.canaimasoft.com
![](/skins/images/45C6C2D737ED71F4C51F0145C8CB1E9C/responsive_peak/images/icon_anonymous_message.png)
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page