简体   繁体   中英

JavaScript Functions In Google Sheets

Can you add JavaScript functions to .gs files and then run functions on Google Sheets?

The use case for me is to make use of Google's https://github.com/googlei18n/libphonenumber to sweep through and sanitise some phone numbers.

This should be possible but would require some manual work of creating files in the Script Editor and manually copying and pasting the code over.

I have had success doing this with other Javascript libraries in the past.

You will need basic Javascript skills, since you'll still need to write a bit of code to leverage the library once you have it moved over. You could use a custom formula function or you could have a function that pulls in the relevant cells from the sheet and processes them before writing them out somewhere.

For custom spreadsheet formulas, see: https://developers.google.com/apps-script/guides/sheets/functions

For processing sheet data within the script, see: https://developers.google.com/apps-script/guides/sheets

Google Apps Script is based on JavaScript, so yes, it's possible. See Using open-source libraries in Apps Script .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM