C#中对Excel文件执行写数据操作
C#中对Excel文件执行写数据操作:
先编写一个函数
private static string CPath(string path)
{
var index = path.LastIndexOf("/");
var temp = path.Substring(0, index);
if (!Directory.Exists(temp))//如果不存在就创建file文件夹
Directory.CreateDirectory(temp);//创建该文件夹
return path;
}
写入数据操作,代码添加在使用函数中。
{
s.WriteLine($"{"列1"},{"列2"}");
}


浙公网安备 33010602011771号