Click on the Run button to run the code.Click on the save icon (□) to save the code.Now that we’ve completed the Apps Script code for the demo application, here are a few more tasks to do. log( "getEntries() data response: %s", JSON. "completion_percentage" : completionPercentage, Calculation for the completion percentage against the targetĬompletionPercentage = ( totalCredit - totalDebit) * 100 / target Outside the for-loop block, type out the code below. ![]() Set the monthYear map key to its valueīarChartData = dateChartData toLowerCase() ĭateChartData = dateChartData + entry Get the entry type and convert to lower case if chart data with the key is null, initialize with default data ![]() get month-year to be used as barChartData key To start creating the implementation, find the function named postEntry() and insert the code below.Įntry = Utilities. In the case of this app, an entry consists of ID, source, amount, type (credit or debit), and date data fields. The following section shows how to save data in Google Sheets. Take note of how the code in the snippet above interacts with the Google Drive storage. Delete the spreadsheet file from Google Drive rootĭriveApp. Add the file to the folder just created Get the new spreadsheet file by its ID Create a spreadsheet and save its reference in a variable Open the spreadsheet, and return an instance of If file exists, open existing spreadsheet, and if not, create one Retrieve spreadsheet file object by its nameįile = topFolder. The first few lines of code in the script file are tasked with initializing some important variables. It contains some TODO instructions to follow. The starter code is designed to encourage learning by doing. SetupĬopy the starter code from the GitHub gist here to the Google Apps Script editor. The code editor offers functionalities such as writing, running, debugging, and deployment of script code. Click on the New Project button to open an empty code editor.To get started, follow these instructions: Get the spreadsheet from Google Drive by name.The aim is to present avenues to programmatically perform specific processes.īy the end of this section, you will be better equipped to do the following with Apps Script: Apps Script facilitates certain tasks across Google products. Google Apps Script is a cloud-based JavaScript platform. For example, the data in cell B5 is “Expenses”, where “B” is the column location and “5” is the row location. A cell can be identified as a block representing the intersection between the column and the row. In this context, cells are the storage units or, in other terms, the boxes you see in the image above. Notice how columns are lettered and rows are numbered. For instance, a financial tracker spreadsheet can have different columns that each specify a unique characteristic of the data, while each row defines a particular entry. A spreadsheet organizes data in rows and columns. Spreadsheets are computer programs that offer a great way to organize data. Below is the completed version of the app.īefore diving into Google Apps Script, let’s briefly describe spreadsheets. On the front end, charts are shown that depict how well a person is doing against the target amount. ![]() The app interacts with Google Sheets to save this information. It enables users to track their expenses and income relative to their financial goals. The demo app is named Financial Goal Tracker.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |