Skip to content

Instantly share code, notes, and snippets.

#Display Google Sheets data on a website using Google Apps Script and JQuery DataTables
@bpwebs
bpwebs / #Creating Multi-Level Cascading Dropdowns in Google Apps Script Web Apps
Last active August 31, 2024 16:20
Creating Multi-Level Cascading Dropdowns in Google Apps Script Web Apps
Creating Multi-Level Cascading Dropdowns in Google Apps Script Web Apps
@bpwebs
bpwebs / #How to Create HTML Data Entry Forms in Google Sheets
Created April 14, 2024 12:41
#How to Create HTML Data Entry Forms in Google Sheets
How to Create HTML Data Entry Forms in Google Sheets
@bpwebs
bpwebs / Code.gs
Created November 18, 2023 19:37
Extract and combine first row of CSV files with Google Apps Script
function extractFirstRowCsvWithFilename() {
const folder = DriveApp.getFolderById("1MBaI_rGJ6t_loANMAvGpDbr2MeHZwxnn");
const files = folder.getFilesByType(MimeType.CSV);
let combinedData = [];
while (files.hasNext()) {
let file = files.next();
let filename = file.getName();
let csvData = Utilities.parseCsv(file.getBlob().getDataAsString());
@bpwebs
bpwebs / Code.gs
Last active November 21, 2023 01:02
Combine CSV Files with Google Apps Script - Prevent the column headers from being repeated in the merged CSV file
function combineCSVWithoutRepeatedHeaders() {
const folder = DriveApp.getFolderById("1MBaI_rGJ6t_loANMAvGpDbr2MeHZwxnn");
const files = folder.getFilesByType(MimeType.CSV);
let combinedData = [];
let firstFile = true;
while (files.hasNext()) {
let file = files.next();
let csvData = Utilities.parseCsv(file.getBlob().getDataAsString());
@bpwebs
bpwebs / Code.gs
Created November 13, 2023 00:52
Combine CSV files with Google Apps Script
function combineCsv() {
const folder = DriveApp.getFolderById("1MBaI_rGJ6t_loANMAvGpDbr2MeHZwxnn");
const files = folder.getFilesByType(MimeType.CSV);
let combinedData = [];
while(files.hasNext()){
let file = files.next();
let csvData = Utilities.parseCsv(file.getBlob().getDataAsString());
combinedData = combinedData.concat(csvData);
}
@bpwebs
bpwebs / Code.gs
Created November 7, 2023 19:17
Access the CSV files in Google Drive with Google Apps Script
function combineCsv() {
const folder = DriveApp.getFolderById("1mSJUg80NRhtorSBBOsJylbDYTDDmpHWY");
const files = folder.getFilesByType(MimeType.CSV);
//Use the files variable
}
@bpwebs
bpwebs / CSS.html
Last active November 7, 2023 18:21
Multi-Page Google Apps Script Web App
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous">
@bpwebs
bpwebs / CSS.html
Created June 29, 2023 15:10
Create Your Own Personal Finance Tracker App with Google Sheets
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous">
<style>
//Your CSS goes here
</style>
@bpwebs
bpwebs / Code.gs
Created May 29, 2023 17:33
How to Calculate the Distance Between Two Addresses in Google Sheets
function CALCULATE_DRIVING_DISTANCE(origin, destination) {
var directions = Maps.newDirectionFinder()
.setOrigin(origin)
.setDestination(destination)
.setMode(Maps.DirectionFinder.Mode.DRIVING)
.getDirections();
var distance = directions.routes[0].legs[0].distance.value;
distance /= 1000; // Convert meters to kilometers