This file contains hidden or 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
let | |
Source = Folder.Contents("C:\Users"), | |
// filter out Public folder as it may be accessed by scripts | |
#"Filtered out Public" = Table.SelectRows( Source, each [Name] <> "Public"), | |
// sort to get last accessed in the top row | |
#"Sort by Date accessed" = Table.Sort( #"Filtered out Public", {{"Date accessed", Order.Descending}}), | |
// filter out potential system folders | |
#"Expanded Attributes" = Table.ExpandRecordColumn(#"Sort by Date accessed", "Attributes", | |
{"Kind", "ReadOnly", "Hidden", "System"}, | |
{"Kind", "ReadOnly", "Hidden", "System"}), |
This file contains hidden or 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
let | |
Delay = 1, // X seconds | |
GroupID = Text.From( GroupID ), // from parameter GroupID | |
url_base = "https://www.yammer.com/api/v1/users/in_group/" & GroupID & ".json", | |
Source = List.Generate( | |
()=> [ | |
i = 2, // we get 1st page by using fGetUsersPage in arg1 | |
url = url_base, | |
Page = fGetUsersPage(url_base), // 1st page | |
more = true, |
This file contains hidden or 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
(url as text) as table => | |
let | |
response = Web.Contents(url, [Headers=[Authorization=#"Authorization"]]), | |
body = Json.Document(response), | |
moreavailable = try Logical.From( body[more_available] ) otherwise false, | |
users = body[users], | |
#"Converted to Table" = Table.FromList(users, Splitter.SplitByNothing(), null, null, ExtraValues.Error), | |
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", | |
{"id", "state", "full_name", "job_title", "mugshot_url", "web_url", "activated_at", "stats", "email"}, | |
{"id", "state", "full_name", "job_title", "mugshot_url", "web_url", "activated_at", "stats", "email"}), |
This file contains hidden or 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
#If VBA7 Then | |
Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal lngMilliSeconds As Long) | |
#Else | |
Private Declare Sub Sleep Lib "kernel32" (ByVal lngMilliSeconds As Long) | |
#End If | |
Dim bManualRefresh As Boolean | |
Sub ManualStart() | |
On Error Resume Next |
This file contains hidden or 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
' Wait function for VBA Excel | |
#If VBA7 Then | |
Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal lngMilliSeconds As Long) | |
#Else | |
Private Declare Sub Sleep Lib "kernel32" (ByVal lngMilliSeconds As Long) | |
#End If | |
' idea from ' http://www.fmsinc.com/microsoftaccess/modules/examples/avoiddoevents.asp | |
Sub WaitSeconds(intSeconds As Integer) | |
Dim datTime As Date |
This file contains hidden or 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 IsWBHasCubeFormulas(Optional Wb As Workbook) As Boolean | |
Dim sh As Worksheet | |
Dim cell As Range | |
Dim bFound As Boolean | |
Dim bScreenUpdatingInitial As Boolean | |
Dim bEnableEventsInitial As Boolean | |
Dim CalcModeInitial As Integer | |
Dim rngFormulas As Range | |
On Error GoTo ErrHandler |
This file contains hidden or 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 removes double presents of specified characters. | |
By default remove double spaces and leading + ending spaces. | |
Like TRIM function in Excel | |
Original is taked from Ken Puls's blog | |
http://www.excelguru.ca/blog/2015/10/08/clean-whitespace-in-powerquery/ | |
*/ | |
// part of repository: https://github.com/IvanBond/pquery |
This file contains hidden or 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
(num as number, optional string as nullable text) => | |
let | |
input_string = if string = null then "" else string, | |
reminder = Number.Mod( num, 2 ), | |
resulting_string = Text.From( reminder ) & input_string, | |
input = Number.IntegerDivide( num, 2 ), | |
r = if input > 0 then |