简体   繁体   English

无法使用 [BlobInput] 读取 .xlsx 文件

[英]Can't read an .xlsx file with [BlobInput]

I'm trying to read an .xlsx file from blob storage but the only option I have is to read it as a string from the binding parameter.我正在尝试从 blob 存储中读取.xlsx文件,但我唯一的选择是从绑定参数中将其作为字符串读取。

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

To load the .xlsx file I need to make a MemoryStream.要加载.xlsx文件,我需要创建一个 MemoryStream。 Thus I wrote:于是我写道:

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

It fails and tells me the file might be corrupt.它失败并告诉我文件可能已损坏。

Any ideas how to read properly an .xlsx file from blob storage as an input?任何想法如何从 blob 存储中正确读取 .xlsx 文件作为输入?

Turns out, except string , byte[] is supported.事实证明,除了stringbyte[]是受支持的。 Therefore I could be able to read and open my file.因此,我可以读取和打开我的文件。 Azure documentation does not mention it yet. Azure 文档尚未提及它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 nodejs 在 azure blob 存储上读取带有 url 签名的 xlsx 文件和 json 文件 - Read xlsx file and json file with url signed on azure blob storage using nodejs 如何在不创建临时文件的情况下使用 Pandas 从 Azure Blob 读取 .xlsx 格式文件 - How to read .xlsx format file from Azure Blob using pandas without creating temporary file 从 azure blob 存储读取 xlsx 到 pandas dataframe 而不创建临时文件 - Read xlsx from azure blob storage to pandas dataframe without creating temporary file AZURE Function 从 AZURE BLOB 读取 XLSX - AZURE Function read XLSX from AZURE BLOB 如何将 xlsx 或 xls 文件读取为 spark dataframe - How to read xlsx or xls files as spark dataframe 具有 HTTP 触发器和 Blob 输入绑定的 Azure 函数 - 无法读取文件夹中的 JSON 文件。 可能的 blob 文件路径错误? - Azure Function with HTTP Trigger and Blob Input Binding - can't read JSON files that are in a folder. Possible blob file path error? BlobInput 的 Azure Function 绑定问题没有任何错误 - Azure Function binding issue for BlobInput without any error 在 Terraform 中,您可以读取然后写入 json 文件吗 - In Terraform can you read then write a json file 使用 Python 从 Azure Blob 下载 XLSX 文件 - Download XLSX File from Azure Blob in Python 如何在 Azure 数据工厂中读取扩展名为 .xlsx 和 .xls 的文件? - How to read files with .xlsx and .xls extension in Azure data factory?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM