【问题标题】:Can't read an .xlsx file with [BlobInput]无法使用 [BlobInput] 读取 .xlsx 文件
【发布时间】:2021-09-13 11:19:41
【问题描述】:

我正在尝试从 blob 存储中读取 .xlsx 文件,但我唯一的选择是从绑定参数中将其作为字符串读取。

[BlobInput("templates/myTemplate.xlsx", Connection = "StorageAccountConnStr")] string template

要加载.xlsx 文件,我需要创建一个 MemoryStream。于是我写道:

var templateBytes = Encoding.Unicode.GetBytes(template);
var templateStream = new MemoryStream(templateBytes);

它失败并告诉我文件可能已损坏。

任何想法如何从 blob 存储中正确读取 .xlsx 文件作为输入?

【问题讨论】:

    标签: azure azure-functions blob


    【解决方案1】:

    事实证明,除了stringbyte[] 是支持的。 因此我可以读取和打开我的文件。 Azure 文档尚未提及。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-03-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-07
      • 1970-01-01
      • 2019-12-03
      • 1970-01-01
      相关资源
      最近更新 更多