Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations pierreick on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

WRITING AN EXCEL FILE FROM BASIC 2

Status
Not open for further replies.

JWB46

Structural
May 31, 2002
67
Hi Guys.

I want to create files that can be read directly as EXCEL files from a BASIC program running under DOS.

What I do right now , for example, is as follows:

1000 OPEN "O",1,A$ + ".RYD"
1005 WRITE #1, "X", "Y", "Z"
1010 WRITE #1, P, Q, R
1015 CLOSE 1

This creates a file named A$.RYD with the data perfectly ok etc, but when trying to read it as an EXCEL file I have to do a bit of messing around to get the numbers to line up in cells properly.

It must be pretty simple to format the data to go directly into EXCEL.

Can anyone help please?

 
Replies continue below

Recommended for you

From Basic, Save as an .XLS file and then read as Fixed Width
 
you can write the file as a "comma separated value" file, or .csv. Excel will automatically read those. Try exporting one from excel for an example.

 
jwb46,

i gather u use the basic program to create the data needed by excel. the process is fine. excel will import the data; however, it helps if the source data (written by basic program) is a comma-seperated, semi-colon-seperated, or some other character seperated file. when excel reads in the data, it will automatically seperate the data into rows and columns.

for example,
basic file contains:

1234567890

excel will import (delimit) the data as one complete number.

whereas, the basic file contains:

1,2,3,4,5,6,7,8,9,0

excel will import (auto delimit) the data into 10 columns, without having to resort to extra effort in seperating the data.

good luck.
-pmover
 
Thanks guys. Very helpful. I will experiment. Watch this space!
JWB46
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor