To create a spreadsheet list of addresses with a column for the month and a tick for payment received, you can use Google Sheets or Microsoft Excel. Here's a step-by-step guide using Google Sheets:
-
Open Google Sheets and create a new spreadsheet.
-
In the first row, label the columns as follows:
- A: Address
- B: Month
- C: Payment Received
-
Fill in the addresses in column A, and the corresponding month in column B.
-
To indicate payment received, you can use checkboxes. To create a checkbox, follow these steps:
- In cell D1 (for example), type
=IF(A1="","",CHECKBOX(A1)). This will create a checkbox that is visible only if the address in cell A1 is not empty. - Copy cell D1 to the entire column C.
- In cell D1 (for example), type
-
To make the checkboxes functional, you need a script to update the payment status. Follow these steps:
- Click on
Extensions>Apps Script. - Delete any existing code and paste the following script:
- Click on
function onEdit(e) {
var sheet = e.source.getActiveSheet();
var range = e.range;
if (range.getColumn() == 3 && range.getValue() == true) {
var address = sheet.getRange(range.getRow(), 1).getValue();
var month = sheet.getRange(range.getRow(), 2).getValue();
var data = SpreadsheetApp.getActiveSpreadsheet().getDataRange().getValues();
for (var i = 1; i < data.length; i++) {
if (data[i][1] == month && data[i][0] != address) {
sheet.getRange(i + 1, 3).setValue(false);
}
}
}
}
- Click on
File>Save. Name the project and clickOK.
- Go back to your spreadsheet, and the checkboxes should now be functional. When you check a box, it will uncheck all other boxes for the same month in the Payment Received column.
Here's the generated HTML output for the first 5 rows:
<table>
<tr>
<td>Address</td>
<td>Month</td>
<td>Payment Received</td>
</tr>
<tr>
<td>123 Main St</td>
<td>January</td>
<td><input type="checkbox"></td>
</tr>
<tr>
<td>456 Oak Ave</td>
<td>January</td>
<td><input type="checkbox"></td>
</tr>
<tr>
<td>789 Pine Rd</td>
<td>February</td>
<td><input type="checkbox"></td>
</tr>
<tr>
<td>321 Elm St</td>
<td>February</td>
<td><input type="checkbox"></td>
</tr>
<tr>
<td>654 Birch Ln</td>
<td>March</td>
<td><input type="checkbox"></td>
</tr>
</table>
References:
- Google Apps Script: onEdit trigger
- Google Apps Script: Checkbox function
- Google Apps Script: getDataRange method
- Google Apps Script: getRange method
- Google Apps Script: getValue method
- Google Apps Script: setValue method
- Google Apps Script: if statement
- Google Apps Script: for loop
- Google Apps Script: comparison operators
- Google Apps Script: array methods
- Google Apps Script: length property