Click here to Skip to main content
13,095,218 members (82,056 online)
Rate this:
Please Sign up or sign in to vote.
See more:
hi, how can SaveAs an excel file in c# without used of dll or namespace?
Posted 22-Jan-13 20:42pm
hemantrautela 23-Jan-13 3:15am
Your Question is not clear, what do you want Download/Upload or convert database report to excel..???

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Hello, f_gharavi

If the Excel file is just missing the extension "xls" or "xlsx" you can change the extension using C#:

Path.ChangeExtension(path, ".xls");

* If is not excel, then you need to create an excel file, fill it with your data, according to the specific parser of your data etc.

If you just want to copy the file to another location and change it's name, use CopyTo:

    string DestinationPath = @"D:\NewFile.xls";
    FileInfo fi = new FileInfo(@"C:\SoureFile.xls");

f_gharavi 26-Jan-13 5:27am
Thank you for your solution, But I have an excel file and I want read that file by C# code and SaveAs that file in another directory with diferent Name, like I have an excel file in c:\ derive and I want read that with c# and SaveAs that in D:\ drive
Edo Tzumer 27-Jan-13 0:45am
Hi, Gharavi,
Added your request to the solution above,


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170813.1 | Last Updated 27 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100