Hi
I have a Canvas App with a button that calls Flow which in turn
- Flow executes SQL stored procedure
- Stored procedure 1 returns rows of JSON
- Flow appends rows of JSON to JSON array (Data)
- Flow executes SQL stored procedure 2
- Stored procedure 2 returns rows of JSON containing column formatting returned in Excel
- Flow appends rows of JSON to JSON array (Formatting rules)
- Flow calls Azure function (Node JS) with Data and Formatting rules
- Azure function uses "json2xls" to read JSON (Data) and output to Excel
- Azure function format worksheet based on (Formatting Rules)
- Azure function returns workbook
- Flow creates sharepoint file with body as returned from Azure Function
When trying to open the spreadsheet from SharePoint I get the following error:
We're sorry, we couldn't open your workbook. It's possibly corrupt or using a file format that's not supported.
You'll need to open this in the desktop app.
The problem seems to be the encoding being defaulted to UTF-8 instead of Windows-1252. I have tried all different Content-types, Charsets and converting to Base64 and back option but the resultant .xlsx file always ends up in UTF-8.
When I create a .js file containing essentially the same code as the Azure function it works 100%.
As the JSON schemas are dynamic and the columns in the spreadsheet must be formatted I can not use options such as creating a CSV file to open in Excel or creating the file in Flow with formatting.
Any suggestions will be geatly appreciated.
Lourens