download invoice documents from Amazon - possible? (4 Viewers)

CJ_London

Super Moderator
Staff member
Local time
Today, 18:01
Joined
Feb 19, 2013
Messages
17,518
Does anyone know if it is possible to download purchase invoices from Amazon to be stored in a windows folder?

I found this link


so looks like it is possible - a two stage process to get the document ID's (for a given date?) then submit the ID's to download the documents.

Before I research further and adapt the GET to work in VBA, just wondered if this has already been done..... (I haven't asked ChatGPT yet)
 
Is there a rest API available? That might be a possible way.

I checked your link, and that's what it is, but it's hard to find VBA code to do it. I'm sure I have posted some previously though.

One issue is that to download a PDF, you collect a string of bytes. But the trouble I found and I couldn't solve it is that access changes a string of bytes into unicode characters, and then the PDF becomes unreasonable. I couldn't get a readable PDF in VBA
 
One issue is that to download a PDF, you collect a string of bytes. But the trouble I found and I couldn't solve it is that access changes a string of bytes into unicode characters, and then the PDF becomes unreasonable. I couldn't get a readable PDF in VBA
It's been a while but I thought I tested this function with PDFs and it worked.
 
@theDBguy
I'm sure I used code very like you showed but I couldn't get it to work. I might not be able to access the Rest API I was using previously, but I might try again and see if it does work.

Perhaps the line of code starting with Put avoids the array of bytes being turned into a unicode text string.
 
But the trouble I found and I couldn't solve it is that access changes a string of bytes into unicode characters
When would that happen?
If you define the data as an array of bytes, I don't see why it would change to a different data type without you doing it in your code.
 
@theDBguy
I'm sure I used code very like you showed but I couldn't get it to work. I might not be able to access the Rest API I was using previously, but I might try again and see if it does work.

Perhaps the line of code starting with Put avoids the array of bytes being turned into a unicode text string.
I would appreciate it if you could let us know what happens, so I can update the article. Cheers!
 
Many thanks for the responses.

Further research - there are three 'methods' of connecting to Amazon, depending on your type of account - Marketplace (selling), Business (buying) and web services. I need Business and the link I provided was to do with Marketplace so has to be discounted as a way forward.

I asked ChatGPT who advised there is no such API for Business which is where I need to be. However within Amazon, Business offers a link to Business Analytics and I can download from there (manually at least) - it downloads a zip file with all the current month (or whatever time period you provide) invoices as pdf's. In the short term this will work for me, and I might be able to use python or javascript to automate further - ideally downloads need to be daily but can live with weekly. The potential problem is Amazon can be quite changeable so any automated process could fail at any time.
 

Users who are viewing this thread

Back
Top Bottom