最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Google app script - move some functions into separate files - Stack Overflow

programmeradmin2浏览0评论

Is there a way to move some functions into separate files in google app script? currently my Code.gs looks like the following:

function onSubmit(e) {}

function readSpreadsheet(sheet) {}
function writeSpreadsheet(sheet, data) {}

function sendEmail() {}

function helperLogic1() {}
function helperLogic2() {}
function helperLogic3() {}
function helperLogic4() {}

So to make my code looks nicer ;p .. I want to move functions related to spreadsheet to spreadsheet.gs email to email.gs etc. So after moving them, how do I load it from the code.gs?

Thanks

Is there a way to move some functions into separate files in google app script? currently my Code.gs looks like the following:

function onSubmit(e) {}

function readSpreadsheet(sheet) {}
function writeSpreadsheet(sheet, data) {}

function sendEmail() {}

function helperLogic1() {}
function helperLogic2() {}
function helperLogic3() {}
function helperLogic4() {}

So to make my code looks nicer ;p .. I want to move functions related to spreadsheet to spreadsheet.gs email to email.gs etc. So after moving them, how do I load it from the code.gs?

Thanks

Share Improve this question edited Oct 30, 2013 at 22:15 Carl Manaster 40.4k17 gold badges108 silver badges157 bronze badges asked Oct 30, 2013 at 21:58 FajarmfFajarmf 2,2734 gold badges21 silver badges23 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 10

You can move any function to any script file inside the same project without restriction, it is indeed easier to read when you split the code in different categories when the code is long.

When you execute any of these function it behaves as if all of them where in the same .gs file. The project is the real container, not the file.

发布评论

评论列表(0)

  1. 暂无评论