Skip to content

Instantly share code, notes, and snippets.

@ndthanh
ndthanh / vEquivalents.gs
Created Sep 28, 2020 — forked from brucemcpherson/vEquivalents.gs
Google Apps Script equivalents for common VBA function
View vEquivalents.gs
/** @description
* javaScript/Google Apps script functions that are equivalent to common VBA functions
* in general these provide the same functionality and have the same calling stack
* See http://ramblings.mcpher.com/Home/excelquirks/codeuse for more details
* @author <a href="mailto:bruce@mcpher.com">Bruce McPherson</a><a href="http://ramblings.mcpher.com"> ramblings.mcpher.com</a>
*/
/**
* Removes leading and trailing whitespace
* @param {string|number} v the item to be trimmed
View extract_numbers.txt
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Mix", type text}}),
#"Added Custom" = Table.AddColumn(
#"Changed Type",
"Custom",
each Text.Combine(List.RemoveNulls(List.Transform(Text.ToList([Name]),
each if Value.Is(Value.FromText(_), type number) then _ else null))))
in
#"Added Custom"
View onEdit_add_time.js
function onEdit() {
var s = SpreadsheetApp.getActiveSheet();
if( s.getName() == "Sheet1" ) { // Thay tên sheet tương ứng
var r = s.getActiveCell();
if( r.getColumn() == 1 ) { // kiểm tra cột đang nhập dữ liệu phải cột thứ 1 hay không
var nextCell = r.offset(0, 1); // dùng offset để ghi thời gian sang cột bên phải
if( nextCell.getValue() === '' ) // kiểm tra xem ô kế tiếp có rỗng không
nextCell.setValue(new Date());
}
}
View unpivot.gs
/**
* Unpivots the given data
* More: https://stackoverflow.com/questions/24954722/how-do-you-create-a-reverse-pivot-in-google-sheets
*
* @return Unpivoted data from array
* @param {object[][]} arr 2D Input Array
* @param {object[][]=} headers [optional] Custom headers for output
* @customfunction
*/
function unpivot(arr, headers) {
View 07_lists.py
# Python List
fruits = ["tao", "chuoi", "cam", "mit", "dua hau", "kiwi", "ca chua"]
# print(type(fruits))
# Access item in list, access first item by index, start from 0
# print(fruits[0])
# print(fruits[1])
# print(fruits[2])
# print(fruits[len(fruits)-1])
View ImportJsonAdvanced.gs
/*====================================================================================================================================*
ImportJSON by Brad Jasper and Trevor Lohrbeer
====================================================================================================================================
Version: 1.5.0
Project Page: https://github.com/bradjasper/ImportJSON
Copyright: (c) 2017-2019 by Brad Jasper
(c) 2012-2017 by Trevor Lohrbeer
License: GNU General Public License, version 3 (GPL-3.0)
http://www.opensource.org/licenses/gpl-3.0.html
------------------------------------------------------------------------------------------------------------------------------------
View ImportJsonFunction.gs
/**
* Imports JSON data to your spreadsheet Ex: IMPORTJSON("http://myapisite.com","city/population")
* @param url URL of your JSON data as string
* @param xpath simplified xpath as string
* @customfunction
*/
function IMPORTJSON(url,xpath){
try{
// /rates/EUR
View one_formula_calendar_short.txt
Thiết lập:
A1=2020
AN1="SUN" hoặc "MON"
Tác giả: T.D.Nguyen
Rút gọn: N.D.Thanh
=ArrayFormula({
{"\/";TEXT(DATE(A1,ROW(1:12),1),"mmmm")}
,{
UPPER(TEXT("1/1/2018"+COLUMN($A$1:$AP$1)-(1+(AN1=TEXT(DATE(2017,1,1),"ddd"))),"DDD"));
View listview_extended.bas
Option Explicit
Private Sub TextBox1_Change()
Dim rng As Range
Dim q As String
q = LCase(TextBox1.Text)
Dim c As Long
Set rng = Range("rngDaten")
Dim strToSearch As String, i As Long
Dim lRow As Long, lCol As Long
With Me.ListView1
View ComponentsScreen.js
import { StyleSheet, Button } from 'react-native';
import React, { Component } from 'react';
import { Platform, View, Text } from 'react-native';
import { BleManager } from 'react-native-ble-plx';
export default class ComponentsScreen extends Component {
constructor() {
super()
this.manager = new BleManager();
You can’t perform that action at this time.