+ Reply to Thread
Results 1 to 6 of 6

Macro that finds (scrapes) some values from a CSV-table or PDF and input them in a report

  1. #1
    Registered User
    Join Date
    10-01-2015
    Location
    Aincrad
    MS-Off Ver
    2010
    Posts
    3

    Red face Macro that finds (scrapes) some values from a CSV-table or PDF and input them in a report

    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.

    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):
    mrexcel. com /forum/excel-ques tions/ 890878-lets-make-macro-can-find-scrape-value-csv-table- input-cell-report.html
    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
    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



    Cheers!
    Last edited by Kirito-kun; 10-01-2015 at 07:50 AM. Reason: Complaints about previous title

  2. #2
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Easy first Macro! Find (scrape) a value from a CSV-table and input it in a report!l

    When you joined the forum recently you agreed to abide by the Forum Rules, but in haste I fear you might not have actually read them. Please stop and take a moment to read them now. We all follow these rules for the benefit of all, as must you. Thanks.

    (link above in the menu bar)

  3. #3
    Registered User
    Join Date
    10-01-2015
    Location
    Aincrad
    MS-Off Ver
    2010
    Posts
    3

    Re: Easy first Macro! Find (scrape) a value from a CSV-table and input it in a report!l

    I looked through them again. Seems like pretty standard forum rules.
    I don't think my post violates any of the terms. Do I? In that case, could you be more specific? Do you want me to change the title?

  4. #4
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Macro that finds (scrapes) some values from a CSV-table or PDF and input them in a rep

    Your post does not comply with Rule 8 of our Forum RULES. Do not crosspost your question on multiple forums without including links here to the other threads on other forums.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

  5. #5
    Registered User
    Join Date
    10-01-2015
    Location
    Aincrad
    MS-Off Ver
    2010
    Posts
    3

    Re: Macro that finds (scrapes) some values from a CSV-table or PDF and input them in a rep

    Okay Kyle! Thanks for the heads up!
    I guess I'm newer to forums than I thought!
    I've now added links to my other similar posts and hope that someone will help me out in one of the communities. When someone does, I'll be sure to remove/resolve the remaining posts. Sounds good?

  6. #6
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Macro that finds (scrapes) some values from a CSV-table or PDF and input them in a rep

    Ok, a few points;

    1. Forget about the PDF - you simply can't do it with any degree of accuracy
    2. It's trivial with a csv - you can just open them in Excel
    3. The crux of this is how to find the values you want. You need to not only tell us how this is done manually, but also provide a mocked up example of the csv in the correct format to test the logic on:

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Scrape Amazon listing details into table
    By cfcMalky in forum Excel General
    Replies: 2
    Last Post: 12-05-2014, 04:50 PM
  2. Learning Curve: Using a macro to input data from an invoice into an expense report
    By brazilianch in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-01-2014, 02:13 PM
  3. Replies: 0
    Last Post: 10-16-2013, 10:58 AM
  4. Easy way of copying a table into a macro?
    By TomWolowiec in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-22-2013, 06:01 PM
  5. find and return multiple matches in a table, then sum and report total
    By cyclops755 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-08-2013, 06:57 PM
  6. Find data in table from from two input conditions?
    By gdallas in forum Excel General
    Replies: 4
    Last Post: 02-11-2010, 12:31 PM
  7. Is there an easy example to create a Pivot Table within a macro
    By Mark in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-20-2006, 01:00 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1