Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

481
Views
How to save .docx file into S3?

I am using python-docx to create document. I want to save this file to AWS S3. Currently what I am doing is, I am creating .docx file and saving it locally using document.save('filename.docx'). Then using s3.meta.client.upload_file('/path/to/file/filename.docx', bucket, 'filename.docx') to save it into S3. Is there any way where I can save .docx file directly into AWS S3 without saving it locally?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Yes, you can. As @ewong suggested, here is a sample code snippet:

import boto3
from io import BytesIO
from docx import Document

s3 = boto3.client('s3')
document = Document()
# ...

with BytesIO() as fileobj:
    document.save(fileobj)
    fileobj.seek(0)
    s3.upload_fileobj(fileobj, 'your-bucket-name', 'your/s3/key')

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!