Parse text/xml received on a webhook to excel file - webhooks

I exported an Excel File from a software called Tally ERP to a webhook. (Used Webhook.site)
I received the file with the following headers :
content-type : text/xml;charset=utf-16 content-length : 4624 unicode : YES
The content that I have received starts like this :
PKNu7VN?Ȗ[Content_Types].xml???N?0E???NY ??tQ` H?0?$???iI??)B?EW~?;sfFSm'??BT??t?JJ?J?*???c?\??mS?O"IVk: ?Σ??Ȝ???#0=CϽ???ߖ???"X,p?A??:q?H????`?H?n1ά?
When I try to copy the raw content (with/without word wrap) and save it as an xlsx file, the file is corrupted.
I also tried exporting PDF, but it's the same issue with PDF.
Am I missing something?
EDIT : The MIME type identified by a few online tools is : application/octet-stream

Related

GO generate incorrect UTF-8 chars like ö

Ik building an GO application where I want to output a cvs string from a buffer out via the http server.
I'm putting it into the csv buffer:
var buffer bytes.Buffer
resp := csv.NewWriter(&buffer)
resp.Write("Schröder")
The output it via the http server:
resp.Flush()
w.Header().Set("Content-Type", "text/csv; charset=utf-8")
w.Write([]byte(buffer.String()))
When I then open my url a csv file is download en opened by Excel. In that excelsheet the field value is converted to "Schröder".
Any idee, i'm already a week stuk on this item?
The problem is not in Go but in Excel. The information that the data are encoded in UTF-8 is lost when saving the file, since there is no such thing as an encoding attribute on saved files.
Thus Excel will just see the plan data and has no information about the encoding. There are several tricks to make Excel do the right guess, like placing the proper byte order mark (BOM) at start of the file. See Is it possible to force Excel recognize UTF-8 CSV files automatically?. But just specifying charset=utf-8 within the HTTP Content-type header will not help since Excel does not get this information.

How to upload a csv file using Swagger Open API 3.0?

I have given the following specification for csv file upload:-
requestBody:
description: .csv file
content:
application/csv:
schema:
type: string
format: base64
I have also tried different types instead of application/csv, like multipart/form-data, text/csv etc. but none of them show a file upload option on the Swagger UI(also tried changing format to byte, binary, but no luck). The documentation mentions file upload only for images(which works fine).
Is there any way we can get the file upload option for csv or pdf files?
As of April 2020, Swagger UI shows the upload button only for application/octet-stream and image/ media types. There's an open issue to support file upload for other media types as well:
https://github.com/swagger-api/swagger-ui/issues/5636
As a workaround, you can try using application/octet-stream instead of application/csv.

how to save file as pdf from binary output using logic app

I have HTTP output for body('HTTP') is -
{"statusCode":200,"headers":{"dataserviceversion":"2.0","sap-metadata-last-modified":"Fri, 09 Aug 2019 10:41:57 GMT",
"Cache-Control":"no-store, no-cache","Date":"Fri,
09 Aug 2019 11:26:58 GMT","Content-Type":"application/atom+xml; type=feed; charset=utf-8","Content-Length":"1365811"},
"body":{"$content-type":"application/atom+xml; type=feed; charset=utf-8","$content":"PGZlZWQgeG1sbn
note - content-type is application/atom+xml
$content is having binary data which is nothing but pdf file.
I want to get this data and convert it into pdf file
into sharepoint connector while create pdf file i send body('HTTP')?['content'] still unable to create a valid pdf file. even tried only body('HTTP') same error.
while opening file it throws error -
in sharepoint create file connector i'm passing that binary string like - base64ToBinary(thatBinaryValue) but in sharepoint type is
"$content-type": "application/octet-stream",
I tried with HTTP trigger to process PDF, and I suppose it's caused by the content expression. If I use the #triggerBody()['$content'] to process pdf content, the file couldn't be open too.
So I change it to #triggerBody() to get the content and it works, so yours should be just body('HTTP'). You could have a try, hope this could help you.
Update: I tried with HTTP action, and got the same result, it's the expression problem. So just change the expression.

What is correct content-type for excel files? without getting any warning

i'm trying to export my datasource from SQLserver to excel 2003 file using this code
Here :
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
Response.AddHeader("Content-Disposition", "attachment;filename=baseline.xls")
the first problem is i have to turn off protected view to open the excel file, the second problem it still give warning massege when i want to open it.
is there any idea how did i wrong ?
the warning sign :
the file you are trying to open, baseline.xls is in a different format than specified by the file extension. verify that the file is not corrupted and is from trusted source before opening the file.
edited : i have tried this line of code to but still have same result
application/vnd.ms-excel

What does "Invalid file type chosen for conversion" mean?

A call to the Docusign API we've been using for a while (POST to /envelopes) has started returning an error sporadically:
status_code: 400
{
"errorCode": "FORMAT_CONVERSION_ERROR_INVALID_FILE_TYPE",
"message": "Invalid file type chosen for conversion."
}
What does this mean?
That should be returned when you're attempting to upload an invalid file type via the API.
What filetype were you attempting to upload? Does your filetype and contents match?
Supported File Types
DocuSign supports the following file types:
DOCUMENT .as, .asl, .asp, .doc, .docm, .docx, .dot, .dotm, .dotx, .htm, .html, .pdf, .pdx, .rtf, .txt, .wpd, .wps, .wpt
DRAWING .dwg, .dxf, .emz, .svg, .svgz, .vdx, .vsd, .vss, .vst IMAGE .bmp, .cdr, .dcx, .gif, .ico, .jpg, .jpeg, .pct, .pic, .png,
.rgb, .sam, .tga, .tif, .tiff, .wpg
PRESENTATION .dps, .dpt, .pot, .potx, .pps, .ppt, .pptm, .pptx
SPREADSHEET .csv, .et, .ett, .xls, .xlsx, .xlt
Note: DocuSign does not support macro-enabled files. To send a macro-enabled file through DocuSign, you must first convert it to PDF
format.
File size limitations
Along with the file format, DocuSign has file size limitations for
your file uploads:
MAXIMUM FILE SIZE 25 MB
RECOMMENDED SIZE 5 MB
For best performance, DocuSign recommends restricting your file
uploads to no more than 5 MB.
Source - DocuSign List of Supported File Types

Resources