Development time for simple functions cut by >90%
Development time for simple functions cut by >90%
Google Docs' spreadsheet and other software tools are free with a Google account. In addition to being a powerful and polished spreadsheet, it is fully integrated with the company's Script language which is based on Java Script. Once successfully written scripts allow you to operate on your Google document or spreadsheet to do practically anything. Examples: enhance the appearance of your spreadsheet, combine columns into new forms of data or edit spreadsheet content automatically. This site provides examples of creating useful script functions in plain English generated by AI (in this case through the Perplexity App).
Mastering Scripting Is Hard Work
Scripts (i.e. tiny JavaScript programs) can help you get more out of Google spreadsheets and potentially reduce errors. However, creating a script can be intimidating, especially for beginners. One way many learn their first Google Script is through online forum sites such as StackOverflow or Reddit.
Unfortunately, neither of these outfits currently allows AI-generated scripts to be posted in response to users' questions. The stated reason for this restriction is that site managers don't have confidence in AI-generated code (though they are increasingly using AI algorithms to police their forums; go figure!). This also ignores the fact that Java depends on black box-like processes which generate difficult-to-grok machine-generated C or assembly code. In fact, AI-generated code — which is meticulously explained by the AI when the function is generated — is more open and transparent than any other high-level computer language. Anyone can read it. Anyone can test it. What's not to trust?
AI Opens Simple JavaScript Coding to Practically Anyone
We take the opposite approach: Why not use "Natural Language Coding" to describe a task you want accomplished with enough accuracy to enable the AI to generated a valid script. This makes it quickly and easier to learn JavaScript, improves logical thinking and greatly speeds development of script functions as well as your prowess over your own spreedsheet or document.
While coding through AIs using natural language has been humorously described as "Revenge of the English Major," the reality is that both precise/analytical verbal skills and an understanding of elements of programming and application development are needed. So it might be more accurate what's come to be called "Vibecoding" as "Revenge of the Tech Writer." (For a 6-minute explanation see: On GPS: The promise of AI, a CNN interview with LinkedIn co-founder Reid Hoffman.)
AI Generated this IF Statement from natural language instructions in 3 seconds.
Any function described on this site can quickly be tested using a Google spreadsheet and its built-in Script Editor. Start Here details the steps you need to follow to harness AI's ability to generate scripts. Starts Here shows how easy it is to create a complex nested IF statement and a set of named ranges which can make code much more readable and supportable. Even if you do nothing else with AI and scripts, generating nested IF statements can save you tons of time and frustration.
Also see the Documentation page for a fuller explanation of how we used AI to generated a script function. The page also explains how AI-generated code fits perfectly into the decades-long trend towards making computer programming more and more accessible.
Pro Tip: When using AI to build Google Script it is faster, easier and less error prone to follow standard programming practices and create a function for each query component. For example, if you are wanting to sort several columns and, also, set their colors, it is recommended to create separate functions for each and then run them under an umbrella 'run( )'-type function. An example of this can be found in the Forecast and Chart a Data Set.
Send any comments to the email below and/or send simple scripting problems that you'd like to see addressed.
AI-Generated Google Script Functions and Charts
The following simplified examples illustrate how anyone can create and use simple Google Scripts. In each case a novice's question is posed, a natural-language AI prompt and the resulting script is shown, as well as a screen capture from the test app.
Building a nested IF statement and creating multiple named ranges ("Start Here" example)
Double-sorting data in a single column (Documentation example)
Many of these examples are from tabs in our Public Proofs-of-Concepts sheet. You can access this sheet in read-only format, make a copy and test and extend these samples.
By the way, such AI-help isn't limited to scripts. Check out AI Generated Formulas to see how AI can enhance spreadsheet analysis and speed development.
Beginner Tip: Only code that has run successful is included however AI's answers tend to evolve so some minor modification to the instructions may be necessary. If script doesn't run successfully the first time, before editing your text prompt quote the Script Editor's exception (error report) back to the AI and ask it for help.