A Simple Start

Are you planning for retirement?  Does your spreadsheet considers everything??… Housing, Vacation Expenses, Future Pensions….check . check ! check!!  but what about taxes?  Maybe you estimate a number? Maybe you ignore it?  Whether you choose to fund this lifestyle with dividends, capital gains, pensions or registered accounts, taxes are likely to be your largest retirement expense.  If you want your retirement budget to be realistic, shouldn’t taxes be modeled as function of the income you choose to fund your retirement lifestyle? Having this number calculated, rather than hard coded can help eliminate one source of budgeting errors.  Considering the various tax treatments for differing income types, perhaps this, one expense that can be optimized.

The Demo Sheet provides a custom function for accessing the TaxSheets Tax Calculation Engine.  Once permissions is granted, the custom function can be invoked from the Google Sheet no differently than any other native function.  Invocation of the function involves passing in one or more Income Objects combined with a relevant jurisdiction and API token.  Optionally Outputfields can be specified to filter the response output.  The function CALC_CAN_TAX is included to accept these inputs.

function CALC_CAN_TAX( headerFields, incomeData, token, year, province, outputFields,  includeHeaderOnResponse)

Income Objects

An Income Object is specified as one or more headerFields  paired with one or more corresponding rows of  incomeData values.

The headerFields  for the Income Object are defined as any subset of the following named data fields. Unless specified, omitted fields from the Income Object are assumed to have values of zero.

  • age
  • ordinaryIncome
  • selfEmploymentIncome
  • qualifiedIncome
  • nonQualifiedIncome
  • capGainIncome
  • otherIncome
  • rrifIncome
  • pensionIncome
  • oasIncome
  • gisIncome
 

Download a demo spreadsheet* and see how our API can be integrated with your existing work.  Along with some sample data, this spreadsheet includes a temporary API Key and the simple code needed to make calls into the Taxsheet’s Calculation Engine.

* You will be asked to accept permission to allow the spreadsheet to connect to the Taxsheet’s Calculation Engine.

Tokens and Jurisdictions

The userToken serves to authenticate the function call on the back end server.  All calls to the back-end server must be authenticated with a valid token.  The jurisdiction parameter is set by passing in an appropriate year and province. When set, these bind the call to an appropriate Tax Engine.  Currently the Taxsheets Tax Engine has implementations that support the TaxCode from 2020 to 2023. 

Outputfields (Optional)

TaxResult outputFields are defined as any subset of the available fields.  The includeHeaderOnResponse,  optionally defines whether the TaxResult Response should include header labels.  Omitting the outputFields parameter in the in the function call will return all fields for the specified input Incomes:

  • taxCredits
  • taxableIncome
  • fedTaxPayable
  • provincialTaxPayable
  • netTaxPayable
  • cppTaxPayable
  • eiTaxPayable
  • clawBacks

Making Multiple Server Calls

Spreadsheets might include multiple calls to the Taxsheet’s calculator.  To improve performance and reduce the amount of data passed to the server, the function may be invoked passing multiple Income Objects. 

VS

Editing the Stub

Finally, the API stub can be modified to better align it with user needs.  By way of example, the function CALC_TAX shows how the TaxResult Object could be generated by hard-coding parameters that are outside the user’s scope of interest.  Editing the AppScript can be done by clicking on the Google Sheet Extensions >> and then selecting the AppScript menu. 

Download a demo spreadsheet* and see how our API can be integrated with your existing work.  Along with some sample data, this spreadsheet includes a temporary API Key and the simple code needed to make calls into the Taxsheet’s Calculation Engine.

* You will be asked to accept permission to allow the spreadsheet to connect to the Taxsheet’s Calculation Engine.