【发布时间】:2019-12-29 04:08:52
【问题描述】:
我需要开发 azure 函数来逐行读取 Excel 文件并将这些数据插入到数据库中
所以通过使用下面的代码,我能够从 HTTP 请求中获取文件
public static IActionResult Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)]HttpRequest req, TraceWriter log)
{
var excel_file = req.Form.Files["file"];
// read file and insert data and to database
return excel_file != null
? (ActionResult)new OkObjectResult(excel_file)
: new BadRequestObjectResult("err..");
}
我看到有很多方法可以在 c# 中读取 excel 表,例如
Microsoft.Office.Interop.Excel
ExcelMapper
OLEDB ..等
但问题是那些需要文件存储路径
问题是我可以在不写入 blob 或其他位置的情况下读取这些 excel 文件
谢谢
【问题讨论】:
标签: c# excel asp.net-core azure-functions