How to avoid triggering pre-total events for each line of the same imported invoice?

I've developed a script that, for some customers, discounts TX ItemCode's to absorb their AvaTax calculated sales tax and present a invoice total including sales tax (but not freight) equal to the original net invoice, but when the invoice is imported from an Excel file a pre-totals event is triggered for each record of the same invoice. The script works accurately, but since I have to trigger re-calulations of AvaTax (which is slow) this increases the run time by a factor based on the number of records. What could I do to avoid triggering the unnecessary pre-total events?