Think Create | Deqing Sun

Import data from spreadsheet to quickbooks with emulated keypress

by on Aug.07, 2017, under Uncategorized

Quickbooks is a good tool create invoices and log expenses, however it’s support of importing a spreadsheet is limited. Here is a way I found to move data from spreadsheet to Quickbooks through emulated keypress.

movedata

 

When filling cells of quickbooks, you can just type and press tab to move to next cell. This give us chance to type automatically. So first step is to generate keypress sequence we need.

function

This step will be done in spread sheet. Spread sheet has built in string functions. We just need to find a empty cell and joint all data we need in same order with tab delimiter, then there will be a long string for typing. Then you go all the way done and join all of them with tab. The final string will be ready for typing script.

For typing I referred to this tutorial

Insert Text With A Keystroke or Shortcut In Any Application


This uses Mac automator with apple script to type.

One important thing to mention is that quickbooks will not response immediately when you change cells, especially “Product/Service” one. So I added some delay to make it safe.

 

on run
set texttowrite to "text to type"
tell application "System Events"
repeat with i from 1 to count characters of texttowrite
if (character i of texttowrite) is equal to " " then
delay 0.1
if (character (i - 1) of texttowrite) is equal to "s" then
delay 0.5
end if
end if
keystroke (character i of texttowrite)
--delay 0.01
end repeat
end tell
end run


Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Blogroll

A few highly recommended websites...