How to Download an Excel File via API

I’m trying to download a resource as an excel file in order to put it into our project which is using Unity. I’m able to get the context and/or details of the resource, but I’m stuck on what to do from there. If possible, I want to then download the excel file. I already have a script that will automatically convert the excel files into Unity.

If I can’t download the whole excel file, I’m okay with downloading individual arrays of strings that I can copy into Unity.

Hello, msinko,

Thank you for reaching out to Transifex.

When downloading a resource from Transifex via API there are a few options. You can download your files in the following formats:

  • The original format of your file. If you uploaded it in xlsx format you will be able to download it as such. This is the default option.
  • Alternatively you can receive your files in either xliff or JSON form. These are the only conversions from the original that are supported currently.

If you have uploaded your source file in xlsx you will be able to download it in that form but if not the only alternatives are the original file format of your file, xliff, and JSON as I mentioned above.

Please feel free to let me know if you have any questions or if I can provide further clarification!

Kind regards,

Antonis

Hi Mylon,

Thanks for getting back to me. What calls should I use in the V3 API to download the file?

As an adendum to this. I’ve managed to use the “Create Translation File Download Action” to get a link, and then use the “Get Translation Download Status”, but it automatically displays odd symbology. An excerpt of which is below: I believe it to be a folder, but I’m not sure what to do with it

PK​:heart::diamonds:F☼�T��:bangbang:���►docProps/app.xmlM�M​:male_sign:�0►D�J��n��:relaxed:A�:clubs:O�C���$+��
:spades:+l�fl�5�↔ck$}�%^�2�����O�@�♫B�◄_b▼0��t7��’�Ú↔��H��N�rJ����S4=�:relaxed:��’u@�U�♫I↓E�y→�����I�:slight_smile:PK​:heart::diamonds:F☼�T �L​:relaxed:�+:slight_smile:◄docProps/core.xml͒�j�0​:female_sign:�_e��(qƠ&��e�
f◄▬"���BGT��♂��♣▼>c�aF♥v��S�����yb8�]♂7�♀#�.}↨�,�\�‼�;�.�1�%5♀C9497�P����k^��>��→�_� �M��<♦,���EG��8y��.b膈��x�/�ֻ�/��W2$◄A0↓����F☼�T�\�#►:spades:�’:bangbang:xl/theme/theme1.xml�Z[s�8¶~��xg�m​:male_sign:�6���:bangbang:siv۴���N▼�◄X�lyd��⌂�G6►˖

Hello Msinko,

Thanks for your response, Let me chime in here since Antonis is out of the office.
I have performed some testing and I was able to replicate the scenario you mentioned, what I will do, is to forward your comments to my dev team and see if there is any approach to get the excel file download working.

Hello Msinko,

I apologize for the delay, It turns out that there is a way to work with this type of files and its by changing content_encoding as its mentioned here

  • using Content-Type application/vnd.api+json the content must be JSON serializable.
    • For content that is directly JSON serializable you can dump the content of the file directly and set the content_encoding attribute to text .
    • For any content, even if it’s not JSON serializable (eg .xlsx, .idml or .docx file extensions), you can encode the file using the base64 encoding and set the content_encoding attribute to base64 .
  • Using Content-Type multipart/form-data the content can be any raw file, and can be send without further processing.

Please give it a try and let me know how it goes or if you encounter any further issues.
Best Regards
Cesar

Hii…

I’m trying to download an excel file via GET api and i tried given solution also but it not works for me any other way to download excel file in readable format
Pls help here stuck for this issue