Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exported Google Sheets functions broke #947

Open
mheffner opened this issue Oct 25, 2022 · 1 comment
Open

Exported Google Sheets functions broke #947

mheffner opened this issue Oct 25, 2022 · 1 comment

Comments

@mheffner
Copy link

(Note: Non-breaking issues are likely not to be prioritized. Please consider a PR in addition to your issue)

Expected Behavior

I'm returning to a previous Google apps script I had built for Google sheets. I haven't worked on it for approximately a year, so it is likely something has changed in the tooling. When I try to build and rerun a test framework I had it is now complaining that it can't find a number of functions, the function names have an additional _1 suffix. I have split the app script out across several Typescript files to modularize the code. I'm looking for any assistance that could return the behavior to the version I had working in the clasp tooling previously.

My layout is similar to the following:

In foo.ts:

export function FOO() {
  ..do something..
}

This function FOO() was callable from a Google sheets cell as =FOO(..). In my test script in test.ts, I had something similar to:

import { FOO } from "../src/foo"

function test_foo() {
   FOO(...)
}

This test function was executed by a command clasp run runAllTests that invoked test_foo.

However, this now throws the error:

ReferenceError: "foo_1" is not defined

What is the correct way to export a function from one function that can be invoked from another file, while also exposing the function as a function in Google sheets?

Actual Behavior

FOO() can be invoked without errors.

Steps to Reproduce the Problem

See above

Specifications

  • Node version (node -v): v16.13.2
  • Version (clasp -v): 2.4.2
  • OS (Mac/Linux/Windows): Linux
@mheffner
Copy link
Author

mheffner commented Oct 25, 2022

This is for the project available here: https://github.com/mheffner/aws-pricing (repo issue: aryounce/aws-pricing#47)

HamzaRabah added a commit to HamzaRabah/gsheet-addon that referenced this issue Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant