Reading an XLSX file in Azure File Storage

Viewed 33

I need to read an Excel file that is located in a folder in Azure File Storage. This is not in blob storage. I cannot download the file to a local drive, since there is none. I cannot seem to get started on how to access the file or read it in place. Can someone help to get me started? thanks

1 Answers

This is the basic code that works!

    ShareClient share = new ShareClient(connectionString, shareName);
    ShareDirectoryClient directory = share.GetDirectoryClient(dirName);
    ShareFileClient file = directory.GetFileClient(filename);
    OpenSettings openSettings = new OpenSettings();

    using (Stream stream = file.OpenRead())
    {
        using (SpreadsheetDocument document = SpreadsheetDocument.Open(stream, false, openSettings))
        {
            readRow();
        }
    }
Related