![](/img/trans.png)
[英]How do I convert Google Docs file (Template for Document) Stored on Google Drive to PDF and download it?
[英]How do I properly open an html document in Google Drive?
我使用Google Drive API創建和打開html文件。 但是問題是文檔打開時像這樣的技術內容(指向CSS,JS文件,HTML標記的鏈接...)
如何使其以用戶友好的形式正確打開?
我的google-api代碼的一部分
def file_to_drive(import_file=None):
service = build('drive', 'v3', credentials=creds)
file_name = import_file
media_body = MediaFileUpload(file_name, resumable=True, mimetype='text/html')
body = {
'title': file_name,
'description': 'Uploaded By You'}
file = service.files().create(body=body, media_body=media_body, fields='id')
谷歌驅動器API是文件存儲api。 它允許您上傳和下載文件。 它沒有打開文件的能力。 您可以與具有訪問權限的某人共享指向該文件的鏈接,然后當他們單擊該鏈接時,該鏈接將在Google Drive Web應用程序中為他們打開。
唯一能夠打開文件進行編輯的api是Google docs api,它使您無法打開google doc文件。 但是,這將需要您將html文件轉換為google docs格式。 即使這是一個選項,您也需要創建自己的“用戶友好形式”的Google api將數據作為json返回,而不是用戶友好的選項(這不是API的用途)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.