Let's make a macro that can find (scrape) a value from a CSV-table and input it to a cell in a report!

Kirito

New Member
Joined
Oct 1, 2015
Messages
2
Hello Internet!

I have a spreadsheet where I make some very simple calculations. We could call it a report, where I divide some single cells with others and get ratios and growth rates etc. (very simple stuff).

Anyway..
Every week, I input new values into some of the cells in this report and I get a new output of ratios and figures for that week. It's only a matter of three or four cells where I need to change to the new values. I find these figures in a PDF that a bank sends me weekly. So I usually scroll through the PDF to find the new figure, and I copy it, and I paste it into a cell in my spreadsheet and my calculation is updated.

What I'd like to do is to automate this entire process. I want to set up a macro that can go fetch that figure in the PDF and update my input cell with the new value so that I get an updated output value with the push of a button. That would be so neat!


However, I have no idea how to set this up. I don't really need to import an entire data set, only those three or four values in the massive table that is inside the PDF.

I realize that Excel might not be able to scrape a PDF, so I've asked the bank to send me CSV:s of the same table that is usually in the PDF. Perhaps a CSV makes this whole thing easier and I could avoid using a third party scraping software?

... So I guess what I instead should try to do is to make a macro that with the push of a button, goes into a certain folder, finds the latest CSV that I've downloaded, imports the CSV to a new sheet in Excel, then searches through the new table, and finds the cell where the figure I'm looking for is, then takes that value and puts it in the input cell in my little report sheet, and thus updates the output to the new weeks value.

I specifically need the macro to search through the CSV-made table to find the figure, because the table will vary in size, and the value I want to extract doesn't always show up in the same spot (nor at the same pdf-page for that matter).

I think the hard part is scraping the CSV (or PDF) for a single value that doesn't always show up in the same place. And also having the macro finding each weeks new file in a folder and update the data table. I think the scraping could be achieved by having the macro find the value by using the row and column name, which should be the same each time, though it ends up on a different page depending on the length of the table. And I think the automatic importing of the newest CSV data set could be achieved by simply naming the file the same thing in the folder, replacing the old one every week upon downloading it.

I've been googling for a couple of days to learn how to what I've attempted to describe above, but without luck. So now I figured I'd try my luck with the community! Any help would be massively appreciated, I'd really like to learn how to increase efficiency through macro-making, and this is a great opportunity for learning some basics. Thanks to anyone who took the time to read this. Once I've learned some more I'll be sure to also contribute to the community by helping others.

Cheers!
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
I've also posted this question in these 3 places (but so far without success, I'll be sure to mark all these posts as SOLVED once someone has been kind enough to help me out):

excelguru.ca/forums/showthread.php?4968-Macro-that-finds-%28scrapes%29-some-values-from-a-CSV-or-PDF-and-inputs-them-in-a-report&p=20473#post20473
excelforum. com /excel-program ming-vba-macros/ 1106905-macro-that-finds-scrapes-some-values-from-a-csv-table- or-pdf-and-input-them-in-a-report.html#post4204756
answers. microsoft. com /en-us/office /forum/office_2010-excel/ lets-make-a-macro-that-can-find-scrape-a-value /9c81e7fc- 9fbc-4984-8704-0c161d3bd1c4?tm=1443532471812&auth=1
 
Upvote 0

Forum statistics

Threads
1,215,688
Messages
6,126,209
Members
449,299
Latest member
KatieTrev

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top