This is a Google Apps Script project for managing shared expenses. It processes raw expense data, splits the expenses among participants, calculates the contributions, and provides transaction recommendations to settle debts.
- Clone the repository to your local machine.
- Go to Google Apps Script Settings Page.
- Click
Google Apps Script API
and enable it. - Install clasp globally using npm:
npm install -g @google/clasp
- Log in to your Google account using clasp:
clasp login
- Create a Google Sheets document.
- Open the script editor by navigating to
Extensions > Apps Script
. - Save the script project and copy the script ID from settings.
- Create a new folder with a name of your choice and navigate to it.
- Run the following command to clone the script project to your local machine:
clasp clone <SCRIPT_ID>
- Copy the contents of the files from this repository into the newly created folder.
- Run the following command to push the script to your app script workspace:
clasp push
- Open Google Appa Script and navigate to the project.
- Go to triggers and create a new trigger for the
UpdateSheets
function to run on sheet change and Save. - Add another trigger for the
UpdateSheets
function to run on form submit and Save. - Add another trigger for the
UpdateForm
function to run on sheet change and Save. - Go to the script editor and click on
Code.gs
. - Run
CreateForm
function to create the form for the sheet and prepare the sheet for the script. - Open the sheet document, navigate to
Participants
sheet, and add the names of the participants.- These names will be displayed in the form and the sheet.
- These names can not contain commas otherwise the script will not work as expected.
- The names must be unique.
- The names will be added from
A
toA<Number of Participants>
cells. A1
cell fromParticipants
sheet will not be read by the script. So you can add a title or a description to the participants.
- Open the sheet document, navigate to
Raw
sheet. - Click on
Tools
and Click onManage Form
and Click onGo to live form
. - Copy the URL of the form and share it with the participants.
- Congrats! You have successfully installed the script. You can now start using the form accessible from the Form URL to add expenses.
- All of your sheets are automatically generated and updated by the script. Except for the
Participants
sheet. AndRaw
sheet. Participants
sheet is where you add the names of the participants. The script will read the names from this sheet.- Until you add the names of the participants to the
Participants
sheet, the options in the form will show as "please", "add", "participants name", "in the", "participants", "sheet". Raw
sheet is where you add the raw data of the expenses using the form. The script will read the data from this sheet.- You can protect the
Participants
andRaw
sheets to show a warning messages when the user tries to edit them to ensure the change is intentional. - Once you settle the debts, you can check the "Settled?" column in the
Raw
sheet to mark the transaction as settled. The script will not consider the settled transactions in the calculations.
- The script will process the raw data and group the expenses by month.
- Note that it will group by the month the expense was reported, not the date the user chose (This is to prevent changes in the monthly summary once a month is over)
- Then the script will calculate the contributions of each participant for each month.
- Finally, the script will provide transaction recommendations to settle debts.
This project is licensed under the MIT License. See the LICENSE file for details.