Downloading data into CSV


#1

Going to:

https://publicrecords.alameda.courts.ca.gov/PRS/Case/CaseDetails/UlAxMTU4MDM2OA%3D%3D

has six tabs. The second tab “Register of Action” will have different number of pages. I would like to put data on all pages (nine in this example) into a csv file.

If I could click on the > symbol to the right of the page number until there is no > symbol on the last page that would get all the pages.

The other issues is how to get and integrate the data from these 9 pages into one csv file.

Ideally the csv file could be assigned the court case file number.


#2

All this can be done with Kantu, but it is a rather complex macro. You will need to use while/endWhile and some checks to loop over the pages.

If you want, we can write the macro for you. Our web macro writing service starts at US$99. Please contact us if this option is interesting.

If you want to do it yourself, we are happy to help here in the forum for free :slight_smile:


#3

This is for volunteer advocacy so there is zero budget.

How do automate exporting the information on the url below into a csv file?

https://publicrecords.alameda.courts.ca.gov/PRS/Case/CaseDetails/UlAxNjgwNzg5MQ%3D%3D

I can stop the script and select all and then paste into a file, but I don’t understand how I can automate this process. Other sites have an export feature that I can automate.


#4

I can’t access your link.
i’ve recently made a looping reading of tables, divided into several pages. All pages are gathered in one csv exported.
I can give you my raw macro, you’ll have to modify it to fit your demands.
Does it suit you?


#5

I would appreciate your macro Dukuu, since I can’t find any example od iterating through a table.


#6

Hello. This was my solution half a year ago. I am not sure it is working now, as i can’t check it (project is gone from me).
Please check the way it is made, if this helps you - i’ll be happy.
Also if you want to discuss it - ping me in message or by mention.

Code of cicle table read to csv
{
  "Name": "MHP_rules_READ_toCSV",
  "CreationDate": "2019-1-5",
  "Commands": [
    {
      "Command": "waitForPageToLoad",
      "Target": "/my-contracts",
      "Value": ""
    },
    {
      "Command": "store",
      "Target": "2",
      "Value": "!timeout_wait"
    },
    {
      "Command": "store",
      "Target": "1",
      "Value": "GLOBAL_line_counter"
    },
    {
      "Command": "store",
      "Target": "1",
      "Value": "GLOBAL_col_counter"
    },
    {
      "Command": "store",
      "Target": "1",
      "Value": "GLOBAL_page"
    },
    {
      "Command": "label",
      "Target": "PAGE",
      "Value": ""
    },
    {
      "Command": "comment",
      "Target": "? all lines passed",
      "Value": ""
    },
    {
      "Command": "store",
      "Target": "true",
      "Value": "!errorignore"
    },
    {
      "Command": "verifyElementPresent",
      "Target": "//tbody/tr[${GLOBAL_line_counter}]",
      "Value": ""
    },

    {
      "Command": "comment",
      "Target": "All lines are passed: refresh counters and goto change page",
      "Value": ""
    },

    {
      "Command": "if",
      "Target": "${!statusOK} == false",
      "Value": ""
    },

    {
      "Command": "store",
      "Target": "false",
      "Value": "!errorignore"
    },
    {
      "Command": "store",
      "Target": "true",
      "Value": "!statusOK"
    },
    {
      "Command": "store",
      "Target": "1",
      "Value": "GLOBAL_line_counter"
    },
    {
      "Command": "store",
      "Target": "1",
      "Value": "GLOBAL_col_counter"
    },
    {
      "Command": "gotoLabel",
      "Target": "PAGER",
      "Value": ""
    },
    {
      "Command": "endif",
      "Target": "",
      "Value": ""
    },
    {
      "Command": "comment",
      "Target": "? read next col element",
      "Value": ""
    },
    {
      "Command": "store",
      "Target": "true",
      "Value": "!errorignore"
    },
    {
      "Command": "storeText",
      "Target": "//tbody/tr[${GLOBAL_line_counter}]/td[${GLOBAL_col_counter}]",
      "Value": "global_temp"
    },
    {
      "Command": "comment",
      "Target": "All elements are read in a line: refresh couters, next line. Save line data to csv",
      "Value": ""
    },
    {
      "Command": "if",
      "Target": "${!statusOK} == false",
      "Value": ""
    },

    {
      "Command": "store",
      "Target": "false",
      "Value": "!errorignore"
    },
    {
      "Command": "store",
      "Target": "true",
      "Value": "!statusOK"
    },
    {
      "Command": "storeEval",
      "Target": "${GLOBAL_line_counter}+1",
      "Value": "GLOBAL_line_counter"
    },
    {
      "Command": "store",
      "Target": "1",
      "Value": "GLOBAL_col_counter"
    },
    {
      "Command": "csvSave",
      "Target": "RULES_list_source",
      "Value": ""
    },
    {
      "Command": "gotoLabel",
      "Target": "PAGE",
      "Value": ""
    },
    {
      "Command": "endif",
      "Target": "",
      "Value": ""
    },
    {
      "Command": "store",
      "Target": "false",
      "Value": "!errorignore"
    },
    {
      "Command": "comment",
      "Target": "Store element data to CSV, go read next col element",
      "Value": ""
    },
    {
      "Command": "store",
      "Target": "${global_temp}",
      "Value": "!csvLine"
    },
    {
      "Command": "storeEval",
      "Target": "${GLOBAL_col_counter}+1",
      "Value": "GLOBAL_col_counter"
    },
    {
      "Command": "gotoLabel",
      "Target": "PAGE",
      "Value": ""
    },
    {
      "Command": "comment",
      "Target": "all lines on page are read: changing page, or ending if no more pages.",
      "Value": ""
    },
    {
      "Command": "label",
      "Target": "PAGER",
      "Value": ""
    },
    {
      "Command": "storeEval",
      "Target": "${GLOBAL_page}+1",
      "Value": "GLOBAL_page"
    },
    {
      "Command": "comment",
      "Target": "no more pages: END",
      "Value": ""
    },
    {
      "Command": "store",
      "Target": "true",
      "Value": "!errorignore"
    },
    {
      "Command": "click",
      "Target": "link=${GLOBAL_page}",
      "Value": ""
    },
    {
      "Command": "if",
      "Target": "${!statusok} == false",
      "Value": ""
    },
    {
      "Command": "store",
      "Target": "false",
      "Value": "!errorignore"
    },
    {
      "Command": "store",
      "Target": "true",
      "Value": "!statusOK"
    },
    {
      "Command": "gotoLabel",
      "Target": "END",
      "Value": ""
    },
    {
      "Command": "endif",
      "Target": "",
      "Value": ""
    },
    {
      "Command": "gotoLabel",
      "Target": "PAGE",
      "Value": ""
    },
    {
      "Command": "label",
      "Target": "END",
      "Value": ""
    },
    {
      "Command": "localStorageExport",
      "Target": "rules_list_source.csv",
      "Value": ""
    }
  ]
}

Best regards!


#7

Thanks! This is really an old school programming language! Your script will help a lot!