- I am new to
Apps Scriptand I am trying to implement where I am taking an input throughGoogle Sheetsby usingApps Script. The user gets prompted with a HTML form through which the user uploads aPDFfile. - The file is further saved in a google drive and further used for processing the
PDF. - One way of importing
csvfile intoGoogle Sheetsis uploading the output to theGoogle Driveand then importing theCSVto a new sheets. I am able to achieve this. - My question is can I cut the
middle-wareofGoogle Driveand directly givebase-64string as an input maybe by usingcallbackurl 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.

