Book
A Book represents General Ledger for a company or business, but can also represent a Ledger for a project or department
It contains all Accounts where Transactions are recorded/posted;
addCollaborator(
email:
string
,
permission:
Permission
):
void
Adds a collaborator to the Book.
Create Accounts on the Book, in batch.
Returns The Accounts created
Create Groups on the Book, in batch.
Returns The Groups created
Batch create Transactions on the Book.
Returns The Transactions created
batchTrashTransactions(
transactions:
Transaction
[],
trashChecked?:
boolean
):
void
Batch trash Transactions on the Book.
batchUpdateTransactions(
transactions:
Transaction
[],
updateChecked?:
boolean
):
void
Batch update Transactions on the Book.
continueTransactionIterator(
query:
string
,
continuationToken:
string
):
TransactionIterator
Resumes a transaction iteration using a continuation token from a previous iterator.
Returns a collection of transactions that remained in a previous iterator when the continuation token was generated
countTransactions(
query?:
string
):
number
Retrieve the number of transactions based on a query.
Returns The number of matching Transactions
createAccount(
name:
string
,
group?:
string
,
description?:
string
):
Account
Create an Account in this book.
The type of account will be determined by the type of others Accounts in same group.
If not specified, the type ASSET (permanent=true/credit=false) will be set.
If all other accounts in same group is in another group, the account will also be added to the other group.
Returns The created Account object
deprecated **
createAccounts(
accounts:
string
[][]):
Account
[]
Create Accounts on the Book, in batch.
The first column of the matrix will be used as the Account name.
The other columns will be used to find a matching AccountType.
Names matching existent accounts will be skipped.
deprecated **
Create a AccountsDataTableBuilder, to build two dimensional Array representations of Accounts dataset.
Returns Accounts data table builder.
Example:
var book = BkperApp.getBook("agtzfmJrcGVyLWhyZHITCxIGTGVkZ2VyGICAgPXjx7oKDA");
var accountsDataTable = book.createAccountsDataTable().build();
Create a BalancesDataTableBuilder based on a query, to create two dimensional Array representation of balances of Account or Group
See Query Guide to learn more
Returns The balances data table builder
Example:
var book = BkperApp.getBook("agtzfmJrcGVyLWhyZHITCxIGTGVkZ2VyGICAgPXjx7oKDA");
var balancesDataTable = book.createBalancesDataTable("account:'Credit card' after:7/2018 before:8/2018").build();
createGroups(
groups:
string
[]):
Group
[]
Create Groups on the Book, in batch.
deprecated **
Create a GroupsDataTableBuilder, to build two dimensional Array representations of Groups dataset.
Returns Groups data table builder.
Example:
var book = BkperApp.getBook("agtzfmJrcGVyLWhyZHITCxIGTGVkZ2VyGICAgPXjx7oKDA");
var groupsDataTable = book.createGroupsDataTable().build();
Create a TransactionsDataTableBuilder based on a query, to build two dimensional Array representations of Transactions dataset.
See Query Guide to learn more
Returns Transactions data table builder.
Example:
var book = BkperApp.getBook("agtzfmJrcGVyLWhyZHITCxIGTGVkZ2VyGICAgPXjx7oKDA");
var transactionsDataTable = book.createTransactionsDataTable("account:'Bank Account' before:1/2019").build();
deleteProperty(
key:
string
):
Book
Delete a custom property
Returns This Book, for chainning.
Formats an amount according to DecimalSeparator and fraction digits of the Book.
Returns The value formated
Formats a date according to date pattern of the Book.
Returns The date formated
Formats a value according to DecimalSeparator and fraction digits of the Book.
Returns The value formated
deprecated **
getAccount(
idOrName:
string
):
Account
Gets an Account object
Returns The matching Account object
Retrieve installed Apps for this Book
Returns The Apps objects
Retrieve the pending events Backlog for this Book
Returns The Backlog object
Create a BalancesReport based on query
Returns The balances report
Example:
var book = BkperApp.getBook("agtzfmJrcGVyLWhyZHITCxIGTGVkZ2VyGICAgPXjx7oKDA");
var balancesReport = book.getBalancesReport("group:'Equity' after:7/2018 before:8/2018");
var accountBalance = balancesReport.getBalancesContainer("Bank Account").getCumulativeBalance();
Returns The closing date of the Book in ISO format yyyy-MM-dd
Returns The collection of this book
Returns The date pattern of the Book. Current: dd/MM/yyyy |
MM/dd/yyyy |
yyyy/MM/dd |
Returns The decimal separator of the Book
Get Book events based on search parameters.
Returns The Events result as an iterator.
getFile(
id:
string
):
File
Retrieve a File by id
Returns The matching File object
getFractionDigits():
number
Returns The number of fraction digits (decimal places) supported by this Book
getGroup(
idOrName:
string
):
Group
Gets a Group object
Returns The matching Group object
Returns All Groups of this Book
Same as bookId param
Returns The id of this Book
getLastUpdateMs():
number
Returns The last update date of the book, in in milliseconds
Returns The lock date of the Book in ISO format yyyy-MM-dd
Returns The name of this Book
Returns The name of the owner of the Book
getPeriodStartMonth():
Month
Returns The start month when YEAR period set
Returns The permission for the current user
getProperties():
any
Returns The custom properties stored in this Book
getProperty(
keys:
string
[]):
string
Returns The property value for given keys. First property found will be retrieved
getSavedQueries():
[]
Returns All saved queries from this book
Returns The time zone of the Book
getTimeZoneOffset():
number
Returns The time zone offset of the book, in minutes
getTotalTransactions():
number
Returns The total number of posted transactions
getTotalTransactionsCurrentMonth():
number
Returns The total number of posted transactions on current month
getTotalTransactionsCurrentYear():
number
Returns The total number of posted transactions on current year
Retrieve a Transaction by id
Returns The matching Transaction object
getTransactions(
query?:
string
):
TransactionIterator
Get Book transactions based on a query.
See Query Guide to learn more
Returns The Transactions result as an iterator.
Example:
var book = BkperApp.getBook("agtzfmJrcGVyLWhyZHITCxIGTGVkZ2VyGICAgIDggqALDA");
var transactions = book.getTransactions("account:CreditCard after:28/01/2013 before:29/01/2013");
while (transactions.hasNext()) {
var transaction = transactions.next();
Logger.log(transaction.getDescription());
}
Instantiate a new Account
Returns The new Account, for chainning.
Example:
var book = BkperApp.getBook("agtzfmJrcGVyLWhyZHITCxIGTGVkZ2VyGICAgIDggqALDA");
book.newAccount()
.setName('Some New Account')
.setType('INCOMING')
.addGroup('Revenue').addGroup('Salary')
.setProperties({prop_a: 'A', prop_b: 'B'})
.create();
Instantiate a new File
Returns The new File, for chainning.
Example:
var book = BkperApp.getBook("agtzfmJrcGVyLWhyZHITCxIGTGVkZ2VyGICAgIDggqALDA");
book.newFile()
.setBlob(UrlFetchApp.fetch('https://bkper.com/images/index/integrations4.png').getBlob())
.create();
Instantiate a new Group
Returns The new Group, for chainning.
Example:
var book = BkperApp.getBook("agtzfmJrcGVyLWhyZHITCxIGTGVkZ2VyGICAgIDggqALDA");
book.newGroup()
.setName('Some New Group')
.setProperty('key', 'value')
.create();
Instantiate a new Transaction
Returns The new Transaction, for chainning.
Example:
var book = BkperApp.getBook("agtzfmJrcGVyLWhyZHITCxIGTGVkZ2VyGICAgIDggqALDA");
book.newTransaction()
.setDate('2013-01-25')
.setDescription("Filling tank of my truck")
.from('Credit Card')
.to('Gas')
.setAmount(126.50)
.create();
parseAmount(
value:
string
):
Amount
Parse an amount string according to DecimalSeparator and fraction digits of the Book.
Returns The Amount parsed
parseDate(
date:
string
):
Date
Parse a date string according to date pattern and timezone of the Book.
Also parse ISO yyyy-mm-dd format.
Returns The date parsed
parseValue(
value:
string
):
Amount
Parse a value string according to DecimalSeparator and fraction digits of the Book.
deprecated **
record(
transactions:
string
|
any
[] |
any
[][],
timeZone?:
string
):
void
Record Transactions on the Book.
The text is usually amount and description, but it can also can contain an informed Date in full format (dd/mm/yyyy - mm/dd/yyyy).
Example:
book.record("#gas 63.23");
deprecated **
removeCollaborator(
email:
string
):
void
Removes a collaborator from the Book.
Rounds an amount according to the number of fraction digits of the Book
Returns The Amount rounded
setClosingDate(
closingDate:
string
|
null
):
Book
Sets the closing date of the Book in ISO format yyyy-MM-dd.
Returns This Book, for chainning.
setDatePattern(
datePattern:
string
):
Book
Sets the date pattern of the Book. Current: dd/MM/yyyy |
MM/dd/yyyy |
yyyy/MM/dd |
Returns This Book, for chainning.
Sets the decimal separator of the Book
Returns This Book, for chainning.
setFractionDigits(
fractionDigits:
number
):
Book
Sets the number of fraction digits (decimal places) supported by this Book
Returns This Book, for chainning.
setLockDate(
lockDate:
string
|
null
):
Book
Sets the lock date of the Book in ISO format yyyy-MM-dd.
Returns This Book, for chainning.
setName(
name:
string
):
Book
Sets the name of the Book.
Returns This Book, for chainning.
Sets the start month when YEAR period set
Returns This Book, for chainning.
setProperties(
properties:
any):
Book
Sets the custom properties of the Book
Returns This Book, for chainning.
setProperty(
key:
string
,
value:
string
):
Book
Sets a custom property in the Book.
Returns This Book, for chainning.
setTimeZone(
timeZone:
string
):
Book
Sets the time zone of the Book
Returns This Book, for chainning.
Perform update Book, applying pending changes.
Returns This Book, for chainning.