Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6550465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:13:09+00:00 2026-05-25T12:13:09+00:00

How can i store excel file created using pyExcelerator as input for db.BlobProperty() ?

  • 0

How can i store excel file created using pyExcelerator as input for db.BlobProperty() ?

Actally what i need is that Using taskqueue program will create a excel file and store it in the datastore. And will send a link to the users to download the file. How do i do this ? Please help me

Datamodel:

class filestore(db.Model):
   stock_file = db.BlobProperty()

Python code for storing the excel file in datastore

from pyExcelerator import *
class MainHandler(webapp.RequestHandler):
  def get(self):                  
     w = Workbook()
     ws = w.add_sheet('Hey, Dude')
     ws.write(0, 0, 'Part Number')        
     self.response.headers['Content-Type'] = 'application/ms-excel'
     self.response.headers['Content-Transfer-Encoding'] = 'Binary'
     self.response.headers['Content-disposition'] = 'attachment; filename="Test.xls"'

     temp_file = filestore()
     temp_file.stock_file = db.blob(wb.save(self.response.out)) // Storing 0kb file 
     temp_file.put()

After inserting new file, file size in 0kb why ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T12:13:09+00:00Added an answer on May 25, 2026 at 12:13 pm

    If your goal is to create an Excel file and save it as a blob for later use you need to first save it as a StringIO object, not construct a response, as you are doing currently.

    Here is a sample using xlwt (a fork of pyExcelerator):

    import xlwt
    
    file_type = 'application/ms-excel'
    file_name = 'sample.xls'
    
    wbk = xlwt.Workbook()
    sheet = wbk.add_sheet('Hey, Dude')
    sheet.write(0, 0, 'Part Number')
    
    file = StringIO.StringIO()
    wbk.save(file)
    file.seek(0)    
    
    with files.open(file_name, 'a') as f:
      f.write('%s' % file.getvalue())
    
    files.finalize(file_name)
    
    blob_key = files.blobstore.get_blob_key(file_name)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am importing an excel file to DB. For that i am using excel-class
Say that I've got a web application that can store Persons in a database.
Is there a class in the .NET BCL that can store a block of
I have developed a web application and various clients can store records to that
How can I give a link to user to download an excel file link
I have a VB.Net program that reads in a flat file, and then parses
I'm looking for recommendations for a good program for 32-bit Windows Vista that will
We can store Chinese character into mysql table Using this ( meta http-equiv=Content-type value=text/html;
I need to get data from an Excel file to print them in a
I am using VS2005 C# and SQL Server 2005. I have an Excel file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.