• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Copying data from website, then pasting into Excel

On this website:
https://www.secform4.com/insider-trading/1018724.htm

I am copying the first table called "Common stock purchase or sale" and pasting it into Excel. When I paste the data, everything was getting pasted into a single column, but now it isn't so I'm not sure what I did differently. Any thoughts?

Now that this is pasting with data in each cell, there are blank rows between each row/entry. Also, some rows have data "carrying over" from the cell above it.

Is there a quick way to fix this so that when I paste the data, it looks like what is shown on the website?
 
I used power Query/Get and Transform to load the data into excel. Seems to be no issues as can be seen in the attached. What version of Excel are you using. Power Query is available to all Windows Versions begining with 2010.
 

Attachments

  • Book20.xlsx
    19.3 KB · Views: 5
I used power Query/Get and Transform to load the data into excel. Seems to be no issues as can be seen in the attached. What version of Excel are you using. Power Query is available to all Windows Versions begining with 2010.

Nice. I thought about trying that but I haven't used PowerQuery too much. In column I, you have Direct and Indirect. When I pasted this into Excel at first, Direct was on one line and Indirect was on another row below. How did you get them to stay together?
 
I did nothing special. Here is the Mcode that PQ created from the UI.

Code:
let
    Source = Web.Page(Web.Contents("https://www.secform4.com/insider-trading/1018724.htm")),
    Data1 = Source{1}[Data],
    #"Changed Type" = Table.TransformColumnTypes(Data1,{{"Transaction Date", type text}, {"Reported DateTime", type datetime}, {"Company", type text}, {"Symbol", type text}, {"Insider Relationship", type text}, {"Shares Traded", Int64.Type}, {"Average Price", Currency.Type}, {"Total Amount", Currency.Type}, {"Shares Owned", type text}, {"Filing", type text}})
in
    #"Changed Type"
 
Click on the Advanced Editor and replace existing code with what I offered. Advance Editor is on the Home Tab of PQ
 
Back
Top