2

I can use javascript Google API to authentifie my webapp and create new file in Google Drive, as it's explained in this post :

function createNewFile() {
    gapi.client.load('drive', 'v2', function() {
        var request = gapi.client.request({
            'path': '/drive/v2/files',
            'method': 'POST',
            'body':{
                "title" : "test.txt",
                "description" : "Some"
            }
        });
        request.execute(function(resp) { console.log(resp); });
    });
}

It creates an empty file in Drive. But I don't know how to create a new non-empty file by adding text content to it (for example "blablabla"). Can someone please help me ?

1
  • Have a loot at this answer. Commented Aug 14, 2012 at 18:01

1 Answer 1

2

Checkout the update function I made for updating a file after insert How do I add/create/insert files to Google Drive through the API?

Read the the main answer on the page, this also hints to create/insert in one call to the API.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.