[google-appengine] How to get the path of a file saved in blobstore ?

2013-11-14 Thread anuja bothra
Hi,

I have data in an excel sheet.
I need to read that data and save it to the datastore.

I am able to upload the excel to blobstore.
How do I get the excel file path to pass to POI (so that I can read the 
cell contents) ? 
My code is in Java

Thanks,
Anuja 

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [google-appengine] How to get the path of a file saved in blobstore ?

2013-11-14 Thread Alejandro González Rodrigo
Hello Anuja,

When you upload a file to the blobstore, in the /_ah/upload callback you
can grab the BlobKey that was uploaded:

BlobstoreService blobstoreService =
BlobstoreServiceFactory.getBlobstoreService();
MapString, ListBlobKey blobs = blobstoreService.getUploads(request);
BlobKey *blobKey* = blobs.get(file).get(0);

You need that blobkey to access the file again. If you want to accecss the
file later, you might want to store it somewhere in the datastore.

With the BlobKey you can retrieve a byte[] of the file to do whatever you
want:

byte[] file = blobstoreService.fetchData(*blobKey*, 0,
BlobstoreService.MAX_BLOB_FETCH_SIZE-1);


Hopes that helps.
Good luck!






2013/11/14 anuja bothra anujabot...@gmail.com

 Hi,

 I have data in an excel sheet.
 I need to read that data and save it to the datastore.

 I am able to upload the excel to blobstore.
 How do I get the excel file path to pass to POI (so that I can read the
 cell contents) ?
 My code is in Java

 Thanks,
 Anuja

 --
 You received this message because you are subscribed to the Google Groups
 Google App Engine group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to google-appengine+unsubscr...@googlegroups.com.
 To post to this group, send email to google-appengine@googlegroups.com.
 Visit this group at http://groups.google.com/group/google-appengine.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
Alejandro González alejandro.gonza...@intelygenz.com
+34 666 57 79 13
http://es.linkedin.com/pub/alejandro-gonzález-rodrigo/19/684/466/

http://www.intelygenz.com/
If you have a dream http://www.intelygenz.com/en/cases* we can write the *
code http://www.thegameofcode.com/

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [google-appengine] How to get the path of a file saved in blobstore ?

2013-11-14 Thread anuja bothra
I actually wanted to parse the file in POI since I already had written code
for that in a local app.

FileInputStream myInput = new FileInputStream(filePath);
POIFSFileSystem myFileSystem = new POIFSFileSystem(myInput);

I need the filePath (the excel file's path) so that I can just pass that
and reuse the code that I had already written.
Is that not possible ?

Thanks


On Thu, Nov 14, 2013 at 3:24 PM, Alejandro González Rodrigo 
alejandro.gonza...@intelygenz.com wrote:

 Hello Anuja,

 When you upload a file to the blobstore, in the /_ah/upload callback you
 can grab the BlobKey that was uploaded:

 BlobstoreService blobstoreService =
 BlobstoreServiceFactory.getBlobstoreService();
 MapString, ListBlobKey blobs = blobstoreService.getUploads(request);
 BlobKey *blobKey* = blobs.get(file).get(0);

 You need that blobkey to access the file again. If you want to accecss the
 file later, you might want to store it somewhere in the datastore.

 With the BlobKey you can retrieve a byte[] of the file to do whatever you
 want:

 byte[] file = blobstoreService.fetchData(*blobKey*, 0,
 BlobstoreService.MAX_BLOB_FETCH_SIZE-1);


 Hopes that helps.
 Good luck!






 2013/11/14 anuja bothra anujabot...@gmail.com

 Hi,

 I have data in an excel sheet.
 I need to read that data and save it to the datastore.

 I am able to upload the excel to blobstore.
 How do I get the excel file path to pass to POI (so that I can read the
 cell contents) ?
 My code is in Java

 Thanks,
 Anuja

 --
 You received this message because you are subscribed to the Google Groups
 Google App Engine group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to google-appengine+unsubscr...@googlegroups.com.

 To post to this group, send email to google-appengine@googlegroups.com.
 Visit this group at http://groups.google.com/group/google-appengine.
 For more options, visit https://groups.google.com/groups/opt_out.




 --
 Alejandro González alejandro.gonza...@intelygenz.com
 +34 666 57 79 13
 http://es.linkedin.com/pub/alejandro-gonzález-rodrigo/19/684/466/

 http://www.intelygenz.com/
 If you have a dream http://www.intelygenz.com/en/cases* we can write
 the *code http://www.thegameofcode.com/




  --
 You received this message because you are subscribed to a topic in the
 Google Groups Google App Engine group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/google-appengine/DBfFbG4NVhY/unsubscribe
 .
 To unsubscribe from this group and all its topics, send an email to
 google-appengine+unsubscr...@googlegroups.com.
 To post to this group, send email to google-appengine@googlegroups.com.
 Visit this group at http://groups.google.com/group/google-appengine.
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [google-appengine] How to get the path of a file saved in blobstore ?

2013-11-14 Thread Alejandro González Rodrigo
Hello Anuja,

No, that is not possible because the actual file is not in the filesystem.
But with the byte[] you can easily get a InputStream checkout:
http://stackoverflow.com/questions/1802123/can-we-convert-a-byte-array-into-an-inputstream-in-java

InputStream myInputStream = new ByteArrayInputStream(file);
POIFSFileSystem myFileSystem = new POIFSFileSystem(myInputStream);



2013/11/14 anuja bothra anujabot...@gmail.com

 I actually wanted to parse the file in POI since I already had written
 code for that in a local app.

 FileInputStream myInput = new FileInputStream(filePath);
 POIFSFileSystem myFileSystem = new POIFSFileSystem(myInput);

 I need the filePath (the excel file's path) so that I can just pass that
 and reuse the code that I had already written.
 Is that not possible ?

 Thanks


 On Thu, Nov 14, 2013 at 3:24 PM, Alejandro González Rodrigo 
 alejandro.gonza...@intelygenz.com wrote:

 Hello Anuja,

 When you upload a file to the blobstore, in the /_ah/upload callback you
 can grab the BlobKey that was uploaded:

 BlobstoreService blobstoreService =
 BlobstoreServiceFactory.getBlobstoreService();
 MapString, ListBlobKey blobs = blobstoreService.getUploads(request);
 BlobKey *blobKey* = blobs.get(file).get(0);

 You need that blobkey to access the file again. If you want to accecss
 the file later, you might want to store it somewhere in the datastore.

 With the BlobKey you can retrieve a byte[] of the file to do whatever you
 want:

 byte[] file = blobstoreService.fetchData(*blobKey*, 0,
 BlobstoreService.MAX_BLOB_FETCH_SIZE-1);


 Hopes that helps.
 Good luck!






 2013/11/14 anuja bothra anujabot...@gmail.com

 Hi,

 I have data in an excel sheet.
 I need to read that data and save it to the datastore.

 I am able to upload the excel to blobstore.
 How do I get the excel file path to pass to POI (so that I can read the
 cell contents) ?
 My code is in Java

 Thanks,
 Anuja

 --
 You received this message because you are subscribed to the Google
 Groups Google App Engine group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to google-appengine+unsubscr...@googlegroups.com.

 To post to this group, send email to google-appengine@googlegroups.com.
 Visit this group at http://groups.google.com/group/google-appengine.
 For more options, visit https://groups.google.com/groups/opt_out.




 --
 Alejandro González alejandro.gonza...@intelygenz.com
 +34 666 57 79 13
 http://es.linkedin.com/pub/alejandro-gonzález-rodrigo/19/684/466/

 http://www.intelygenz.com/
 If you have a dream http://www.intelygenz.com/en/cases* we can write
 the *code http://www.thegameofcode.com/




  --
 You received this message because you are subscribed to a topic in the
 Google Groups Google App Engine group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/google-appengine/DBfFbG4NVhY/unsubscribe
 .
 To unsubscribe from this group and all its topics, send an email to
 google-appengine+unsubscr...@googlegroups.com.

 To post to this group, send email to google-appengine@googlegroups.com.
 Visit this group at http://groups.google.com/group/google-appengine.
 For more options, visit https://groups.google.com/groups/opt_out.


  --
 You received this message because you are subscribed to the Google Groups
 Google App Engine group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to google-appengine+unsubscr...@googlegroups.com.
 To post to this group, send email to google-appengine@googlegroups.com.
 Visit this group at http://groups.google.com/group/google-appengine.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
Alejandro González alejandro.gonza...@intelygenz.com
+34 666 57 79 13
http://es.linkedin.com/pub/alejandro-gonzález-rodrigo/19/684/466/

http://www.intelygenz.com/
If you have a dream http://www.intelygenz.com/en/cases* we can write the *
code http://www.thegameofcode.com/

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [google-appengine] How to get the path of a file saved in blobstore ?

2013-11-14 Thread anuja bothra
Hey Thanks Alejandro !!


On Thu, Nov 14, 2013 at 3:52 PM, Alejandro González Rodrigo 
alejandro.gonza...@intelygenz.com wrote:

 Hello Anuja,

 No, that is not possible because the actual file is not in the filesystem.
 But with the byte[] you can easily get a InputStream checkout:
 http://stackoverflow.com/questions/1802123/can-we-convert-a-byte-array-into-an-inputstream-in-java

 InputStream myInputStream = new ByteArrayInputStream(file);
 POIFSFileSystem myFileSystem = new POIFSFileSystem(myInputStream);



 2013/11/14 anuja bothra anujabot...@gmail.com

 I actually wanted to parse the file in POI since I already had written
 code for that in a local app.

 FileInputStream myInput = new FileInputStream(filePath);
 POIFSFileSystem myFileSystem = new POIFSFileSystem(myInput);

 I need the filePath (the excel file's path) so that I can just pass
 that and reuse the code that I had already written.
 Is that not possible ?

 Thanks


 On Thu, Nov 14, 2013 at 3:24 PM, Alejandro González Rodrigo 
 alejandro.gonza...@intelygenz.com wrote:

 Hello Anuja,

 When you upload a file to the blobstore, in the /_ah/upload callback you
 can grab the BlobKey that was uploaded:

 BlobstoreService blobstoreService =
 BlobstoreServiceFactory.getBlobstoreService();
 MapString, ListBlobKey blobs = blobstoreService.getUploads(request);
 BlobKey *blobKey* = blobs.get(file).get(0);

 You need that blobkey to access the file again. If you want to accecss
 the file later, you might want to store it somewhere in the datastore.

 With the BlobKey you can retrieve a byte[] of the file to do whatever
 you want:

 byte[] file = blobstoreService.fetchData(*blobKey*, 0,
 BlobstoreService.MAX_BLOB_FETCH_SIZE-1);


 Hopes that helps.
 Good luck!






 2013/11/14 anuja bothra anujabot...@gmail.com

 Hi,

 I have data in an excel sheet.
 I need to read that data and save it to the datastore.

 I am able to upload the excel to blobstore.
 How do I get the excel file path to pass to POI (so that I can read the
 cell contents) ?
 My code is in Java

 Thanks,
 Anuja

 --
 You received this message because you are subscribed to the Google
 Groups Google App Engine group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to google-appengine+unsubscr...@googlegroups.com.

 To post to this group, send email to google-appengine@googlegroups.com.
 Visit this group at http://groups.google.com/group/google-appengine.
 For more options, visit https://groups.google.com/groups/opt_out.




 --
 Alejandro González alejandro.gonza...@intelygenz.com
 +34 666 57 79 13
 http://es.linkedin.com/pub/alejandro-gonzález-rodrigo/19/684/466/

 http://www.intelygenz.com/
 If you have a dream http://www.intelygenz.com/en/cases* we can write
 the *code http://www.thegameofcode.com/




  --
 You received this message because you are subscribed to a topic in the
 Google Groups Google App Engine group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/google-appengine/DBfFbG4NVhY/unsubscribe
 .
 To unsubscribe from this group and all its topics, send an email to
 google-appengine+unsubscr...@googlegroups.com.

 To post to this group, send email to google-appengine@googlegroups.com.
 Visit this group at http://groups.google.com/group/google-appengine.
 For more options, visit https://groups.google.com/groups/opt_out.


  --
 You received this message because you are subscribed to the Google Groups
 Google App Engine group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to google-appengine+unsubscr...@googlegroups.com.
 To post to this group, send email to google-appengine@googlegroups.com.
 Visit this group at http://groups.google.com/group/google-appengine.
 For more options, visit https://groups.google.com/groups/opt_out.




 --
 Alejandro González alejandro.gonza...@intelygenz.com
 +34 666 57 79 13
 http://es.linkedin.com/pub/alejandro-gonzález-rodrigo/19/684/466/

 http://www.intelygenz.com/
 If you have a dream http://www.intelygenz.com/en/cases* we can write
 the *code http://www.thegameofcode.com/




  --
 You received this message because you are subscribed to a topic in the
 Google Groups Google App Engine group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/google-appengine/DBfFbG4NVhY/unsubscribe
 .
 To unsubscribe from this group and all its topics, send an email to
 google-appengine+unsubscr...@googlegroups.com.
 To post to this group, send email to google-appengine@googlegroups.com.
 Visit this group at http://groups.google.com/group/google-appengine.
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group