I am creating a web-application in which I want to integrate Google Docs using Google Drive. I have made it. Now my next task it append some data to that opened google doc using Drive API. So I want cursor position for that. But i don't know how to find out cursor position using drive API? I searched lot on a google and found solution that I can do that using google APP Script. I am constantly getting this error "DocumentApp is not defined". I am working with Google Drive using Drive API. When I am trying to fetch current opened google doc using
DocumentApp.openById('My-file-Id');
but I am constantly getting this error "documentApp is not defined". Please help me to fix it out or show me the right way to do this.
function printFile(fileId)
{
$("#demo_scope").collapse('show');
var response_data = '<span class="custome_span_text"><center><img src="<?php echo base_url("img/loading.gif");?> "> Wait open the document ...</center></span>';
$("#google_drive_iframe").show();
$("#google_drive_iframe").html(response_data);
var request = gapi.client.drive.files.get({
'fileId': fileId
});
request.execute(function(resp)
{
if(resp.code != 404)
{
file = resp;
var file_id = file.id;
var some_magic = DocumentApp.openById('My-file-Id'); <!-- Here i am getting error -->
var file_title = file.title;
var file_modifiedDate = new Date(file.modifiedDate);
var exportLinks = file.exportLinks;
var exportLink_html = exportLinks["text/html"];
$("#google_doc_filenm").val(file_title);
$("#doc_file_id").val(file_id);
$("#google_drive_iframe").show();
$("#google_drive_iframe").html('<iframe src="'+file.alternateLink+'" onclick="checkFocus();" class="google_iframe"></iframe>');
}
else
{
$("#google_drive_iframe").html("<center><span class='error_title'><i class='glyphicon glyphicon-remove'></i> Google Document has been not available !</span></center>");
alertify.error("Please select google document");
return false;
}
});
}