I've been implementing a google drive connector into a web application.
Basically when a known event is triggered in the page it launches a webhook which communicates with the 'drive-connector' in order to generate a document and fill it with some information.
This 'drive-connector' is a custom PHP which uses the Google Drive API to create folders and files. I am able to create the folders and files and give the files the desired content.
To give the content to the drive document I use an HTML template (https://developers.google.com/drive/api/v3/manage-uploads) which is allowed by the API, before uploading it I change some variables inside the template with the data that comes from the webhook, all well for now.
The problem
I'm able to upload the HTML document, once I replace the variables for the desired data, but It has to be very simple and without much css. When I try to upload the document from a more worked and beautiful template Google Drive doesn't recognize many CSS and it changes the appearence of the document. I can't put a header nor a footer. Many fields are moving from its places and making a mess of the whole document.
In order to make it easier for me to replace the variables in the template I choosed to use HTML anyways I'm starting to think that would be easier to use a .doc or .odt template ( I would need to use a library in order to do that )
My question
Is good to use an HTML document as template for the google drive document? Or should I change the way I am trying to achieve this?
Thanks in advance
Observation: Since I don't really have problem with my code I haven't put any line of code, how ever If you need the HTML template to guess if it has any problem, just tell me.
EDIT 1 -> I've found this: How can developers edit a Google Doc programmatically? Is there a Docs API?
It is not the answer of my question but seems to have some solutions to my problem. Anyways I don't get much clear in that post, I haven't found the proper documentation so I'm still fighting to get this.
EDIT 2-> Reading again the documentation I thought that I could make the document firstly in the google drive and then using the API download it as HTML, this way I would have the template but I'm not sure if I could modificate it has I wish. If this works I will reply my own question and close the post
After trying this I could not upload the HTML which was exported from the google doc. The error that the google api gives me is: code 400 message: bad request