• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Delete row and column in spreadsheet without using drive api

Varunled

Lurker
Could anyone help me on the question I have written in the below link

stackoverflow dot com/questions/42782720/delete-row-and-column-in-spreadsheet-without-using-drive-api

Thanks
 
Hi, welcome to Android Forums.

Unfortunately your question isn't very clear. The code you show simply reads a Json data structure into an Array. There's no spreadsheet involved. Please clarify. Thanks.
 
Hi, welcome to Android Forums.

Unfortunately your question isn't very clear. The code you show simply reads a Json data structure into an Array. There's no spreadsheet involved. Please clarify. Thanks.

Thanks for your reply .We have another class specified in the overflow forum where datas from spreadsheet are retrieved by JSON and saved in an array. Kindly go through the code once again.
 
Nope. Still not getting it. Don't see any mention of a spreadsheet. Maybe it would help to post your code here.
Please use [code][/code] tags to format the code.
 
Nope. Still not getting it. Don't see any mention of a spreadsheet. Maybe it would help to post your code here.
Please use [code][/code] tags to format the code.

I can provide you my complete code if you want again but spreadsheet link is private access

Java:
public class HomeFragment extends Fragment implements SwipeRefreshLayout.OnRefreshListener, View.OnClickListener {

ProgressDialog pd;
private  String[] board_size = {"Select Your Size", "8 x 6 ft", "10 x 8 ft", "12 x 8 ft", "12 x 10 ft", "16 x 10 ft", "16 x 12 ft", "20 x 10 ft", "22 x 10 ft", "24 x 12 ft", "30 x 10 ft", "40 x 10 ft", "50 x 10 ft", "60 x 10 ft", "70 x 10 ft", "80 x 10 ft"};

ListView lstv11;
ArrayList<AshTable> array111;


SwipeRefreshLayout mSwipeRefreshLayout;

private Button bt1;
private Button bt2;


@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);

}

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
   View view = inflater.inflate(R.layout.fragment_home,
           container, false);



   array111=new ArrayList<>();

   mSwipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.swiperefresh);
   mSwipeRefreshLayout.setOnRefreshListener(this);


   lstv11=(ListView)view.findViewById(R.id.lst_vw1);

   bt1 = (Button) view.findViewById(R.id.but_add);
   bt1.setOnClickListener(this);






   getActivity().runOnUiThread(  new Runnable() {
       @Override
       public void run() {
           new HomeFragment.ReadJSON().execute([COLOR=#ff4d4d]"https://script.google.com/macros/s/xxxx);[/COLOR]
       }
   });



   return view;


}

@Override
public void onRefresh() {

   array111.clear();

   getActivity().runOnUiThread(  new Runnable() {
       @Override
       public void run() {
           new HomeFragment.ReadJSON().execute("[COLOR=#ff4d4d]https://script.google.com/macros/s/xxxx[/COLOR]");
       }
   });
}


public class ReadJSON extends AsyncTask<String,Integer,String> {



   @Override
   protected String doInBackground(String... params) {
       return readURL(params[0]);
   }

   @Override
   protected void onPreExecute() {

   }


   @Override
   protected void onPostExecute(String content){

       try {

           JSONObject jsonObject=new JSONObject(content);
           JSONArray jsonArray=jsonObject.getJSONArray("BaseAshTable");

           for(int i=0;i<jsonArray.length();i++){
               JSONObject prdobj = jsonArray.getJSONObject(i);

               String test1 = prdobj.getString("Timestamp");
               String test2 = prdobj.getString("Company_Name");
               String test3= prdobj.getString("Person_Name");
               String test4 = prdobj.getString("Address");
               String test5 = prdobj.getString("Mail_ID");
               String test6 = prdobj.getString("Mobile_1");
               String test7 = prdobj.getString("Mobile_2");
               String test8 = prdobj.getString("Show_Name");
               String test9 = prdobj.getString("Dispatch_Date");
               String test10 = prdobj.getString("Dispatch_Time");
               String test11 = prdobj.getString("Start_Date");
               String test12 = prdobj.getString("Start_Time");
               String test13 = prdobj.getString("Setup_Date");
               String test14 = prdobj.getString("Setup_Time");
               String test15 = prdobj.getString("Show_End_Date");
               String test16 = prdobj.getString("Show_End_Time");
               String test17 = prdobj.getString("Dismantel_Date");
               String test18 = prdobj.getString("Dismantel_Time");
               String test19 = prdobj.getString("Venu");
               String test20 = prdobj.getString("Venue_Address");
               String test21 = prdobj.getString("Board_Size");
               String test22 = prdobj.getString("Overall_sqft");
               String test23 = prdobj.getString("Rate_Per_Sqft");
               String test24 = prdobj.getString("Total_Amount");
               String test25 = prdobj.getString("Transport");
               String test26 = prdobj.getString("Stage");
               String test27 = prdobj.getString("Power");
               String test28 = prdobj.getString("Other_Costs_1");
               String test29 = prdobj.getString("Other_Cost_2");
               String test30 = prdobj.getString("Gross_Amount");
               String test31 = prdobj.getString("Bill_Required");
               String test32 = prdobj.getString("Company_Name");
               String test33 = prdobj.getString("Billing_In_Name_Of");
               String test34 = prdobj.getString("Service_Tax");
               String test35 = prdobj.getString("Total_Amount_2");
               String test36 = prdobj.getString("Advance_Amount");
               String test37 = prdobj.getString("Credit_Period");
               String test38 = prdobj.getString("Photographer_Name");
               String test39 = prdobj.getString("Photographer_Mobile");
               String test40 = prdobj.getString("Photographer_Email");
               String test41 = prdobj.getString("Marketing_Person_Name");
               String test42 = prdobj.getString("Remarks");


               array111.add(new AshTable(test1, test2, test3, test4, test5, test6, test7, test8, test9, test10, test11, test12, test13, test14, test15, test16, test17, test18, test19, test20, test21, test22, test23, test24, test25, test26, test27, test28, test29, test30, test31, test32, test33, test34,test35,test36,test37,test38,test39,test40,test41,test42));

           }


       } catch (JSONException e) {
           e.printStackTrace();
       }

       final CustomListViewAdapter adapter=new CustomListViewAdapter(getActivity(),R.layout.home_list_view, array111);
       lstv11.setAdapter(adapter);


       mSwipeRefreshLayout.setRefreshing(false);

   }

}




private static String readURL(String theUrl) {

   StringBuilder content = new StringBuilder();

   try {
       URL url = new URL(theUrl);
       URLConnection connection = url.openConnection();
       BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
       String line;

       while ((line = reader.readLine()) != null) {
           content.append(line + "\n");
       }
       reader.close();

   } catch (IOException e) {
       e.printStackTrace();
   }
   return content.toString();

}

@Override
public void onClick(View v) {

   if (v == bt1) {
       Intent intent=new Intent(getActivity(),Submit_form.class);
       startActivity(intent);

   } else if (v == bt2) {



   }

}
}
[/plain][/code]


In the above code text marked in red is link to spreadsheet but I can't provide you the full link as its confidential.
 
So you have loaded all your Json items into an ArrayList, which is used as the data for ListView.

If your question is, how to delete items from the list, then it's simply a matter of deleting from your ArrayList, then calling notifyDatasetChanged() on your ListAdapter.

I can't possibly offer any answer on how to delete items from your spreadsheet if you are not able to supply the code being used.
 
So you have loaded all your Json items into an ArrayList, which is used as the data for ListView.

If your question is, how to delete items from the list, then it's simply a matter of deleting from your ArrayList, then calling notifyDatasetChanged() on your ListAdapter.

I can't possibly offer any answer on how to delete items from your spreadsheet if you are not able to supply the code being used.


K fine
 
Last edited:
Back
Top Bottom