- I am new to
Apps Script
and I am trying to implement where I am taking an input throughGoogle Sheets
by usingApps Script
. The user gets prompted with a HTML form through which the user uploads aPDF
file. - The file is further saved in a google drive and further used for processing the
PDF
. - One way of importing
csv
file intoGoogle Sheets
is uploading the output to theGoogle Drive
and then importing theCSV
to a new sheets. I am able to achieve this. - My question is can I cut the
middle-ware
ofGoogle Drive
and directly givebase-64
string as an input maybe by usingcallback
url to the Google Sheets and the output is generated?
CodePudding user response:
Something like this?
function myFunction() {
var csv_string = 'aa,bb,cc\n11,22,33'; // original csv string
var base64data = Utilities.base64Encode(csv_string); // encoded string
console.log(base64data);
var decoded = Utilities.base64Decode(base64data); // decoded string
console.log(decoded);
var string = Utilities.newBlob(decoded).getDataAsString(); // csv string
console.log({string});
var array = Utilities.parseCsv(string) // 2d array
console.log(array)
}
Here is my sheet.