Hi @Chinmay Dole ,
I am using the following code. Please check if it is useful for you. It is working fine for me.
private static string LoadFileFromAzureBlobStorage(string fileUrl)
{
string filePath;
try
{
filePath = fileUrl[..fileUrl.IndexOf('?')]; // Removes the SAS token
}
catch (Exception ex)
{
filePath = fileUrl;
}
string fileExtension = Path.GetExtension(filePath).ToLowerInvariant(); // Gets extension
// Check the file extension
switch (fileExtension)
{
case ".xlsx":
case ".xls":
case ".doc":
case ".docx":
return $"https://docs.google.com/viewer?url={Uri.EscapeDataString(fileUrl)}&embedded=true";
default:
return fileUrl;
}
}