Fortran Can Fortran77 Write a File to Excel without Using Tab Separation?

AI Thread Summary
The discussion centers on the challenge of writing data to an Excel file in a way that separates values into distinct cells. The initial inquiry seeks an algorithm to achieve this, specifically mentioning issues with data not being separated correctly. A suggested solution involves creating a tab-delimited text file using Fortran, which can be read by Excel. An example code snippet demonstrates how to write numbers separated by tabs, ensuring they appear in separate cells when imported into Excel. Additionally, it is noted that writing a true Excel file format is complex, and an alternative approach is to create a comma-separated values (CSV) file, which Excel can easily interpret if the file is saved with a .CSV extension. This method simplifies the import process, as Excel will recognize the file type automatically.
mme58105
Messages
5
Reaction score
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
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:
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
 
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.
 
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
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...
Back
Top