I have the following use case:
I created a spreadsheet, in which I am trying to create a menu item that lets the user upload a text file from which to process and create a new sheet.
The lines of this text file have the following format:
[complexity] [package] [funcName] [absolutePathname]
What do you mean "process"?
By "processing the file", I mean, getting its contents, preferably as a BLOB or something similar, without uploading to the Drive (this project is for my employer, whose given me other main tasks, and who also has a shared Team Drive), transforming each line of data into the following format:
[package]/[filename] [complexity]
The problem
I already have my own algorithm for transforming the string line to this format, but first, I need to know how to upload the file.
It seems like everything I can find on file uploading, is outdated. For example, this resource is using all kinds of Google API functions that are deprecated.
User story(ies)
As a spreadsheet user, when I click on custom menu item to upload file a file upload prompt should appear.
The closest thing that I know of is to act on
SpreadsheetApp.getUi()
which returns a Ui. However, there's nothing in here that will easily create a file upload prompt. None of the available buttons are for file upload.
doPost()function in server code. Alternatively, You can prevent forms from submitting and run your own server code withgoogle.script.run. This is a exact duplicate of forms, were the code in SO. - TheMaster