+ Reply to Thread
Results 1 to 9 of 9

Import from a csv and process In and out data

  1. #1
    Registered User
    Join Date
    01-07-2020
    Location
    Vermont
    MS-Off Ver
    Office 2016
    Posts
    6

    Import from a csv and process In and out data

    I'm trying to do math to determine rewards for people staking their tokens in a cryptocurrency farming contract. The explorer for the contract has a button that exports a .csv file. Each line of the file is either a user staking (moving tokens from their wallet address to the contract address) or un-staking (moving tokens from the contract address to their wallet address). We need a file that can import the data from the .csv file and then determine who is still staking in the contract, how much they are staking, and what percentage of the total pool that represents.

    The important fields in the csv file are From, To, DateTime, and Quantity

    When the user's wallet address is in the "from" field and the contract address is in the "to" field that is them staking to the contract.

    When the contract address is in the "from" field and their wallet address is in the "to" field that is them un-staking.

    DateTime and Quantity tell us how many tokens were moved in or out of the contract and when they were moved.

    We need to get a list of wallet addresses that still have tokens staked in the contract, and how many they have remaining, and what percentage of the total pool each wallet holds.

    There would only be one field which requires a manual user input, and that would be the address of the contract, since we have multiple contracts that we may be calculating from.

    I guess I have two problems 1) the best way to either pull the data into a sheet from the external csv file, or to paste formulae into the csv file? and 2) converting the unsorted from and to transactions into a total for each wallet.
    Attached Files Attached Files
    Last edited by kcentric; 08-01-2021 at 12:04 PM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,192

    Re: Import from a csv and process In and out data

    You can import the .csv file from its location on your system:

    Data ribbon | From Text/CSV.

    You can then use PowerQuery to manipulate it or add your formulae.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,305

    Re: Import from a csv and process In and out data

    give us a clue, is the contract address 0x3056923a2321c6d73036927541a1017cca522cb5
    Torachan,

    Mission statement; Promote the use of Tables, Outlaw the use of 'merged cells' and 'RowSource'.

  4. #4
    Registered User
    Join Date
    01-07-2020
    Location
    Vermont
    MS-Off Ver
    Office 2016
    Posts
    6

    Re: Import from a csv and process In and out data

    Yes, sorry that is it. I realized that my question was a bit wordy so I cut some text out, unfortunately that was part of the text.

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,192

    Re: Import from a csv and process In and out data

    It would be helpful if you provided a mock-up of how you want this to look once processed to give us an idea of what we are aiming for. A visual is better than words.

  6. #6
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,305

    Re: Import from a csv and process In and out data

    As a starter look at the attached - it has a long-winded macro on the orange button.
    All I have done is load the .csv file direct to Excel (you will need to look at 'All files' in the search dialog box.
    The macro needs columns ("H:N") so leave clear - this needs @Jindons 'magic dust' sprinkling on the macro to reduce it to ten lines of code.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    01-07-2020
    Location
    Vermont
    MS-Off Ver
    Office 2016
    Posts
    6

    Re: Import from a csv and process In and out data

    So the way I imagined it is at the top of the sheet 1) a button that says "Import .csv file" It browses for the file. 2) An input box that says "Paste Farming Contract Address" where the user pastes the address to be tested, and then 3) a button that says "Process" which would sort the list into the rows below sorting by how many tokens each wallet still had staked the largest at the top and the smallest or zero at the bottom (or preferrably with the zero holders not listed at all).

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,192

    Re: Import from a csv and process In and out data

    Can you mock up your imaginings in a workbook and post it here?

  9. #9
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,305

    Re: Import from a csv and process In and out data

    there is no need to paste a .csv into a sheet - you can open it direct into Excel.

+ 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. [SOLVED] Need to replicate Access process (import routine) in Excel
    By skydivetom in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 07-18-2020, 06:44 AM
  2. PROCESS TRACKING-Process status should be Displayed base from the next blank Cell
    By RAMILJAYLDOMA in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-16-2019, 09:17 AM
  3. How to use VBA to automate Adobe Acrobat's "Import Data" process?
    By mockions in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-13-2015, 02:48 AM
  4. process data in text file and import to worksheet
    By copythat in forum Excel General
    Replies: 0
    Last Post: 02-01-2012, 12:03 PM
  5. [SOLVED] PLEASE!! How can I un-grey the 'Data-Import External Data-Import Data' option ???
    By kirkm in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 08-08-2006, 05:05 AM
  6. How to count process running time ( process not finished)
    By miao jie in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-13-2005, 06:06 AM
  7. [SOLVED] How to count process running time ( process not finished)
    By miao jie in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-12-2005, 02:06 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