Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can't create sheet when importing Excel
I am trying to create an Excel file from my C# program using the Process
function as follows: string runprog = "c:\\Program Files\\Microsoft Office\\OFFICE12\\Excel.exe"; Process.Start(runprog, excelfile); When Excel opens up it puts my data from excelfile into a sheet named after the filename itself. I save the file and then I try to read it later using the following command: strSQL = "SELECT * FROM [excelfile] It says that it doesn't recognize this table or library. So I have 2 questions: 1. Is there a way I can force the imported data to be stored as a sheet rather than under the filename I am importing? 2. If not, how do I get my SQL command to recognize the table from my excel file. Right now the only way I can get it to work is to manually import the data as a sheet and then use the command strSQL = "SELECT * FROM [Sheet1$]. I want to be able to do its automatically thru a program rather than to manually create the excel file. Does anyone have suggetions on these questions? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Importing into excel spread sheet | Excel Discussion (Misc queries) | |||
Importing excel sheet | Excel Discussion (Misc queries) | |||
Importing from Excel Sheet Problem | Excel Discussion (Misc queries) | |||
Is it possible to create a mailing list in excel, not importing d. | New Users to Excel | |||
help: code for importing xml into excel sheet | Excel Programming |