Hi, don't mention like
"../../files/Test.xlsx" to store in the directory of the project.
Use like the following,
string filename = Environment.CurrentDirectory + "\Test.xlsx";
Or you can use this also,
string filename = AssemblyDirectory + "\Test.xlsx";
public static string AssemblyDirectory
{
get
{
string codeBase = Assembly.GetExecutingAssembly().CodeBase;
UriBuilder uri = new UriBuilder(codeBase);
string path = Uri.UnescapeDataString(uri.Path);
return Path.GetDirectoryName(path);
}
}