This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Load necessary package | |
library(here) | |
# Function to create a directory if it doesn't exist and include a README file | |
create_dir_if_not_exist <- function(dir_name) { | |
dir_path <- here(dir_name) | |
if (!dir.exists(dir_path)) { | |
dir.create(dir_path, recursive = TRUE) | |
message("Directory created: ", dir_path) | |
# Create README file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function onOpen() { | |
var ui = SpreadsheetApp.getUi(); | |
// Or DocumentApp or FormApp. | |
ui.createMenu('Main Menu') | |
.addItem('Create Tallying Sheet', 'copy2') | |
.addItem('Archive Data', 'archive_data') | |
.addToUi(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//get date of entry | |
function onEdit(e) { | |
var ss = SpreadsheetApp.getActiveSheet(); | |
var r = ss.getActiveCell(); | |
//1.Change 'Sheet1' to be matching your sheet name | |
if (r.getColumn() < 9 && ss.getName()=='Data_entry') { // 2. If Edit is done in any column before Column (I) And sheet name is Sheet1 then: | |
var celladdress ='I'+ r.getRowIndex() | |
ss.getRange(celladdress).setValue(new Date()).setNumberFormat("MM/dd/yyyy"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// funtion to clear the mpesa upload for new entries | |
function clearRange() { | |
// get spreasheet details | |
var sheet = SpreadsheetApp.getActive().getSheetByName('Mpesa upload summary'); | |
// get the cell range and call clear method | |
sheet.getRange('B2:E').clearContent(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Authenticate to Google drive and get the required dataset | |
from google.colab import auth | |
auth.authenticate_user() | |
import gspread | |
from gspread_dataframe import get_as_dataframe, set_with_dataframe | |
from oauth2client.client import GoogleCredentials | |
gc = gspread.authorize(GoogleCredentials.get_application_default()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
idx = 0 | |
new_col = [7, 8, 9] # can be a list, a Series, an array or a scalar | |
df.insert(loc=idx, column='A', value=new_col) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pd.to_datetime(df.date_col, format='%d-%m-%Y') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[x.strip() for x in df.columns] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function onOpen() { | |
var ui = SpreadsheetApp.getUi(); | |
// Or DocumentApp or FormApp. | |
ui.createMenu('Main Menu') | |
.addItem('Create Tallying Sheet', 'copy2') | |
.addToUi(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print ("Adding all numbers from 0 to 100") | |
num = 0 | |
print("Enter Your Minumum Number") | |
range_min = input() | |
print("Enter Your Maxium Number") | |
range_max = input() | |
#Converting strings to numbers | |
formated_range_min = int(range_min) | |
formated_range_max=int(range_max) |
NewerOlder