Forum Discussion

preetiverma1's avatar
preetiverma1
Qrew Member
5 years ago

read the docx file in the document attachment

Hi Team,

 how can i  read the  document(docx)  from attachment using python.

i have created one formula url for document and tried to read  the data  but i am getting all  CSS data on the page from the formula URL (URLRoot() & "up/" & [_DBID_DOCUMENTS] & "/a/r" & [Record ID#] & "/e8/v0&")
it is not giving me the document data.

Thanks 
Preeti

------------------------------
preeti verma
------------------------------
  • AustinK's avatar
    AustinK
    Qrew Commander
    Can you explain how you are trying to read the data with Python(SDK or just Requests)? Maybe post the code you are using? It should be a pretty simple GET request to the URL of the file if you boil it down to the basics. Once you get the data returned are you doing anything else with it?
    • preetiverma1's avatar
      preetiverma1
      Qrew Member
      Hi Austin,

      Yes i used  requests.request("GET", url). I successfully achieved the data
      data -- title, description and attachment document.

      now i am trying to read the doc document but  i am getting the CCS data on the page instead of the text on the docx  document   when i used the formula URL for the attachment.

      when i used the same approach local so my code is working fine but i used  for the QB its  not working fine. 

      so how can i do or need to change the approach??

      Thanks  


      ------Original Message------

      Can you explain how you are trying to read the data with Python(SDK or just Requests)? Maybe post the code you are using? It should be a pretty simple GET request to the URL of the file if you boil it down to the basics. Once you get the data returned are you doing anything else with it?
      • AustinK's avatar
        AustinK
        Qrew Commander
        Hard to say without being able to test it myself. Have you tried not using a formula URL and creating the URL yourself in the code and seeing if you can reach the file?

        I would start by seeing just what is being returned to you, read the HTML on the page. See iof it is an error or anything like that. With Python it can be tricky to get fully authenticated with Quick Base sometimes. I've had issues in the past anyway. You are handling your token and all that yourself when doing these requests?

        This might be of some help to you. Further down there is code by David Choi that uses requests that you could emulate.

        https://community.quickbase.com/communities/community-home/digestviewer/viewthread?MessageKey=ccf46a98-1d3a-43a4-b3dd-09ad28b68f98&CommunityKey=d860b0f8-6a48-487b-b346-44c47a19a804&tab=digestviewer------

        Since you said you have it working locally I am going to assume the issue is not with the file itself and reading inside it(since docx is kind of weird and not like a regular text file) and that the issue is with the authentication or token usage maybe.