An open API service indexing awesome lists of open source software.

https://github.com/nosix/kotlin-gas-example

An example of a project that uses Kotlin/JS to edit Google Apps Script.
https://github.com/nosix/kotlin-gas-example

Last synced: 2 months ago
JSON representation

An example of a project that uses Kotlin/JS to edit Google Apps Script.

Awesome Lists containing this project

README

        

# Usage

## Setup

1. Set Google Apps Script URL to `scriptUrl` in `build.gradle.kts`.

1. Install node modules and generate external APIs.

```shell script
./gradlew generateExternalsMinimal
```

It generates `build/js/node_modules` and `src/main/kotlin/externals`.

1. Clone Google Apps Script project.

```shell script
./gradlew claspLogin
./gradlew claspClone
```

It needs `build/js/node_modules/.bin/clasp`.

# Edit

1. Edit source code in `src/main/kotlin`.

1. Build `dist`.

```shell script
./gradlew compileKotlinJs
```

1. Push `dist` to Google Apps Script project.

```shell script
./gradlew claspPush
```

## Test

1. Add a script into Google Apps Script project.

```javascript
function myFunction() {
example.printHello();
example.printActiveSheetName();
}
```

1. Run `myFunction`.

1. Check log.

Note: `printActiveSheetName` function needs Spreadsheet.