javascript - Writing a custom file format downloader in Google Spreadsheets -
what i'm aiming write akin file > download > *
functionality in google spreadsheets, want in custom format.
specifically, want turn spreadsheet of financial transactions qif or ofx file importing accounting software. in essence, pushing button on ui download qif/ofx version of open spreadsheet.
i have tried next far:
publishing service (via implementingdoget
) uses contentservice
create custom file , homecoming download using textoutput.downloadasfile()
. works if phone call endpoint straight using browser. tried redirecting browser service's url via window.location, doesn't seem available in context of app script. tried using urlfetchapp.fetch
have front-end (the spreadsheet) have browser navigate url service. didn't work either (not surprising). so, right approach here? how else can attack this?
looks have do.
create uiapp add link download within app. show uiinstance on spreadsheetit's little bit bulky, seems cleanest solution.
function downloadaswhatever() { var app = uiapp.createapplication(); app.add(app.createanchor("download file now!", "https://script.google.com/macros/s/[...]/exec")) spreadsheetapp.getactivespreadsheet().show(app.setwidth(300).setheight(150)); }
you can set size of app whatever you'd like. chose set smaller takes less space on spreadsheet screen.
for best way direct user new page create anchor widget , have them click it. understand not ideal user experience, should suffice must utilize cases.
source
javascript google-apps-script google-spreadsheet google-apps
No comments:
Post a Comment