API pull report.name (within template_report.py)

DidDoggggg
DidDoggggg Expensify Customer Posts: 2
edited May 3 in Integrations and API

Hello,


I'm using the API to export all the expense data in CSV out of Expensify to my BI software.

I'm current running a code which uses the following template_report.py.

Everything works well EXCEPT the report.name part (last line of the code) which always returns empty cells. I'm surprised because the report.status values are exported fine.

NB1 : Report names are of a standard format "YYYY-Month.FirstName LastName"

NB2 : I've also tried to replace ${report.name}<#lt> with ${quoteCsv(unescapeHtml(report.name))}<#lt> and adding the definition of the quoteCsv & unescapteHtml earlier in the template_reporty.py code (as suggested in the API documentation ?) but it didn't work either.


Many thanks in advance for your help.

Yours, Did Doggggg


=========TEMPLATE_REPORT.PY===========

template = """

<#if addHeader == true>

    Report created¨ Transaction made¨ Merchant¨ Amount¨ modifiedAmount¨ modifiedCreated¨ modifiedMerchant¨ Devise¨ MCC¨ Category¨ Tag¨ Reimbursable¨ Billable¨ Account email¨ Attendees¨ TVA_percentage¨ Status¨ Description¨ AmountConvertedCurrency¨ ReportName<#lt>

</#if>

<#assign reportNumber = 1>

<#assign expenseNumber = 1>



<#list reports as report>

    <#list report.transactionList as expense>

        <#assign attendeeList = "">

        <#list expense.attendees as attendee>

         <#assign attendeeList = attendeeList + attendee.email + ", ">

        </#list>

        ${expense.created}¨<#t>

        ${expense.inserted}¨<#t>

        ${expense.merchant}¨<#t>

        <#-- note: expense.amount prints the original amount only -->

        ${expense.amount}¨<#t>

        ${expense.modifiedAmount}¨<#t>

        ${expense.modifiedCreated}¨<#t>

        ${expense.modifiedMerchant}¨<#t>

        ${expense.currency}¨<#t>

        ${expense.mcc}¨<#t>

        ${expense.category}¨<#t>

        ${expense.tag}¨<#t>

        ${expense.reimbursable?string("true", "false")}¨<#t>

        ${expense.billable?string("true", "false")}¨<#t>

        ${report.accountEmail}¨<#t>

        ${attendeeList?remove_ending(", ")}¨<#t>

        ${expense.taxRate}¨<#t>

        ${report.status}¨<#t>

        ${expense.comment}¨<#t>

        ${expense.convertedAmount}¨<#t>

        ${report.name}<#lt>

        <#assign expenseNumber = expenseNumber + 1>

    </#list>

    <#assign reportNumber = reportNumber + 1>

</#list>

"""

Tagged:

Answers