简体   繁体   中英

Google apps script : script to import xlsx file in google drive

I usually use google cloud connect. wondering if I have spreadsheet always sync with my updated xlsx automatically. It's look like import button in spreadsheet or upload button in google drive, I think. How do apps script do this case?

we all expect to have a "convertToGDocsFormat" member in File's DocsList API. (Actually, we expect the makeCopy member to have an option to convert it in the copy process.)

But DocsList API is experimental and perhaps incomplete, it doesn't have such method yet. For now you can't convert a file to Google format from a script.

There is another (long) way to read data from a xlsx. Supposed you have the xlsx file sync'ed. You can access it using the experimental DocsList API, and get a blob.

XLSX file is a ZIP file you can unzip with Utilities.unzip not documented method that gives you an un zipped blob.

Then you have to navigate the tree folder (in the blob) to get the XML files you want to read (from the blob). This tree folder and its XML files describe the entire XLSX spreadsheet.

Finally you may parse such XML file and navigate trough it and get cells' values.

This is not quick to code, nor to execute.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM