+ Reply to Thread
Results 1 to 5 of 5

Import Data From a Website

  1. #1
    Registered User
    Join Date
    01-20-2016
    Location
    Boston, MA
    MS-Off Ver
    Office 2011 Mac
    Posts
    15

    Import Data From a Website

    Hello Again Everyone! I hope you are all doing well since the last time I posted

    I play Massachusetts state keno, and in the past I was able to copy the numbers off lottery's website, and paste them all into rows in Excel. Now the lottery has changed their website, so when I copy the numbers, they paste horizontally into columns instead of vertically into rows. I realize I can transpose each one individually, but that would take way too much effort, and time.

    I believe what I am looking to do I guess is run a power query? Where the data is imported automatically into Excel from the lottery's website. I am looking to import all past results as well as all future results.

    Attached is an example of the layout which includes the first 20 keno draws from today (6/5/23)

    Also attached below are the links to the Massachusetts State Lottery keno past draws, as well as a link to Massachusetts State Lottery Data Base for today (I only know how to find the data bases by days, and not all the draws on one page)

    https://www.masslottery.com/tools/pa...sort_by=oldest

    https://www.masslottery.com/api/v1/k...ate=2023-06-05

    I appreciate your help with this issue. Thank you all
    Attached Files Attached Files
    Last edited by etm6477; 06-05-2023 at 10:46 PM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,888

    Re: Import Data From a Website

    I have copied only the first 40 lines of data (2 games). If this is what you are looking for then with Power Query unpivot your data as shown in the attached.

    Excel 2016 (Windows) 64 bit
    A
    B
    C
    D
    1
    DATE GAME # Attribute Value
    2
    6/5/2023
    2576968
    1
    2
    3
    6/5/2023
    2576968
    2
    8
    4
    6/5/2023
    2576968
    3
    9
    5
    6/5/2023
    2576968
    4
    13
    6
    6/5/2023
    2576968
    5
    18
    7
    6/5/2023
    2576968
    6
    23
    8
    6/5/2023
    2576968
    7
    24
    9
    6/5/2023
    2576968
    8
    27
    10
    6/5/2023
    2576968
    9
    39
    11
    6/5/2023
    2576968
    10
    47
    12
    6/5/2023
    2576968
    11
    48
    13
    6/5/2023
    2576968
    12
    53
    14
    6/5/2023
    2576968
    13
    56
    15
    6/5/2023
    2576968
    14
    58
    16
    6/5/2023
    2576968
    15
    61
    17
    6/5/2023
    2576968
    16
    66
    18
    6/5/2023
    2576968
    17
    67
    19
    6/5/2023
    2576968
    18
    68
    20
    6/5/2023
    2576968
    19
    71
    21
    6/5/2023
    2576968
    20
    80
    22
    6/5/2023
    2576969
    1
    5
    23
    6/5/2023
    2576969
    2
    22
    24
    6/5/2023
    2576969
    3
    27
    25
    6/5/2023
    2576969
    4
    28
    26
    6/5/2023
    2576969
    5
    31
    27
    6/5/2023
    2576969
    6
    32
    28
    6/5/2023
    2576969
    7
    35
    29
    6/5/2023
    2576969
    8
    37
    30
    6/5/2023
    2576969
    9
    38
    31
    6/5/2023
    2576969
    10
    39
    32
    6/5/2023
    2576969
    11
    40
    33
    6/5/2023
    2576969
    12
    43
    34
    6/5/2023
    2576969
    13
    50
    35
    6/5/2023
    2576969
    14
    62
    36
    6/5/2023
    2576969
    15
    64
    37
    6/5/2023
    2576969
    16
    67
    38
    6/5/2023
    2576969
    17
    70
    39
    6/5/2023
    2576969
    18
    74
    40
    6/5/2023
    2576969
    19
    77
    41
    6/5/2023
    2576969
    20
    79
    Sheet: Table1
    Attached Files Attached Files
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    01-20-2016
    Location
    Boston, MA
    MS-Off Ver
    Office 2011 Mac
    Posts
    15

    Re: Import Data From a Website

    Alan, I provided an excel sample of how I want it to look. I'll attach a PDF below of that excel page in case you couldn't see it
    I'd like the 20 numbers from each game to go in each row, and not vertically in each column.
    Is there a way that we can do that? Look at the sample & let me know. Thank you.
    Attached Files Attached Files

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,888

    Re: Import Data From a Website

    I am very confused. The data in your spreadsheet and pdf look like the data on the website. I don't know what your issue is. Maybe you need to elaborate on your explanation.

  5. #5
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: Import Data From a Website

    There's software that would really help with capturing tables on websites called "Table Capture" - It's a Chrome extension that I use for a similar thing.

    However, you can use this macro as long as you are pasting the data in the same way I am, and it will transpose for you (and you can have as much pasted data in one sheet as you want, the only kicker is that I've set it up in a way to run the macro on a per date basis). So I pasted two pages of the data into a sheet and I renamed the sheet to the date "6-5-2023" then runt he macro "mTransposeMe" and it will put it all on a new tab.

    Could be modified to do more and append to the same set of data but the way I did it is a one off you would then copy that or format it however. If you're doing this all the time it might be better to make it append to the existing sheet or whatever.

    Please Login or Register  to view this content.
    Quote Originally Posted by alansidman View Post
    I am very confused. The data in your spreadsheet and pdf look like the data on the website. I don't know what your issue is. Maybe you need to elaborate on your explanation.
    He wants it to look like the website, the issue is when copy and pasting from the website into Excel, it puts all the scores in rows and not horizontally.
    Attached Files Attached Files
    Last edited by NewYears1978; 06-06-2023 at 02:32 PM.

+ 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. Replies: 4
    Last Post: 03-24-2021, 03:22 AM
  2. Import website data
    By anavasis in forum Excel General
    Replies: 0
    Last Post: 08-29-2017, 04:07 AM
  3. import data to website
    By georgeb9 in forum Excel General
    Replies: 1
    Last Post: 09-30-2016, 08:56 AM
  4. import data from website using VBA
    By gimer84 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-23-2015, 07:15 AM
  5. import data from a website
    By Bishonen in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-03-2012, 06:39 PM
  6. [SOLVED] import data from website
    By Cicada in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-05-2012, 05:34 PM
  7. Import Data from a Website
    By mrsrinivas1988 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-29-2011, 07:14 AM

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