Fortran77 write file to excel

In summary, you are trying to write a comma delimited text file that Excel can import, and you have provided an example of how to do so using Fortran. You also mention that writing a true Excel file would be complex and suggest using a .CSV file extension to make importing easier.
  • #1
5
0
I have problem don't use tab to separate cell for writing file to excel.
this algorithm write file to excel one cell only.i want write file separate cell on excel file.
please suggest me about algorithm write file in excel file.
 
Technology news on Phys.org
  • #2
Unfortunately your question isn't clear. Are you asking how to write a tab into a Fortran output file? If yes, here's an example:

Code:
      open (unit=10, file='excel.txt')
      write (10,*) 3.14159, char(9), 2.71828, char(9), 1.4142
      close (unit=10)
      end

This produces a tab-delimited text file with three numbers, that excel can read. I had to click through two screens in Excel's file-import wizard, first to choose that the file is delimited, second to choose the delimiter (tab). Each number goes into a separate cell.
 
Last edited:
  • #3
I write program follow as below.I have problem data after write to excel file don't separate cell.Please suggest me.
Algorithm
program writefile
implicit real*8(a-h,o-z)
integer*8 a1,a2,a3
real*8 b1,b2,b3
b1=1.0d+00
b2=2.0d+00
b3=3.0d+00

open(unit=7,file='writefile.xls',status='unknown')
write(7,300) b1,b2,b3
300 format(2x,'Load',f6.1/
*,2x,'Height',f6.1/
*,2x,'Deflect',f6.1)
stop
end
Result
Load 1.0
Height 2.0
Deflect 3.0
 
  • #4
Writing a true Excel file would be complex. I assume you're trying to write a comma delimited text file that Excel can then import. If you suffiix the file name with .CSV, Excell will assume it's a comma separated value text file. Otherwise, you'll have to select comma delimited file as the file type when you do the import.
 
  • #5
rcgldr said:
Writing a true Excel file would be complex. I assume you're trying to write a comma delimited text file that Excel can then import. If you suffiix the file name with .CSV, Excell will assume it's a comma separated value text file. Otherwise, you'll have to select comma delimited file as the file type when you do the import.

Thank you very much
 

1. How can I write a Fortran77 file to an Excel spreadsheet?

In order to write a Fortran77 file to an Excel spreadsheet, you will need to use an external library or subroutine that allows for writing to Excel files. These libraries often have specific functions or syntax for writing to Excel, so be sure to consult the documentation for the one you are using.

2. Can I write multiple data types to an Excel spreadsheet using Fortran77?

Yes, you can write multiple data types to an Excel spreadsheet using Fortran77. However, you will need to use the appropriate formatting or conversion functions to ensure that the data is written correctly to the spreadsheet. For example, you may need to convert numeric data to character data before writing it to the spreadsheet.

3. Do I need any special software or tools to write a Fortran77 file to Excel?

Yes, you will need to use a library or subroutine that specifically allows for writing to Excel files. These libraries may need to be installed separately or included in your Fortran77 compiler. You may also need to have Microsoft Excel or a compatible program installed on your computer in order to open and view the Excel file.

4. Can I customize the layout and formatting of the Excel spreadsheet when writing from Fortran77?

Yes, you can customize the layout and formatting of the Excel spreadsheet when writing from Fortran77. This can be done by using the appropriate functions or formatting options provided by the external library or subroutine you are using. You may also be able to manipulate the data before writing it to the spreadsheet to achieve the desired layout and formatting.

5. Are there any limitations to writing a Fortran77 file to Excel?

There may be some limitations to writing a Fortran77 file to Excel, depending on the external library or subroutine you are using. Some limitations may include the type and amount of data that can be written, as well as the formatting options available. It is important to consult the documentation for the library or subroutine you are using to understand any potential limitations.

Suggested for: Fortran77 write file to excel

Replies
13
Views
1K
Replies
3
Views
1K
Replies
8
Views
1K
Replies
10
Views
1K
Replies
8
Views
712
Replies
5
Views
1K
Replies
1
Views
302
Back
Top